This file (hdat9600_final_assignment.Rmd) is the R Markdown document in which you need to complete your HDAT9600 final assignment. This assignment is assessed and will count for 30% of the total course marks. The assignment comprises two tasks worth 15 marks each. The first task will focus on logistic regression, and the second task will focus on survival analysis. There is no word limit, but a report of about 10 pages in length when printed (except that it will not be printed) is appropriate.
Don’t hesitate to ask the course convenor for help via OpenLearning. The course instructor are happy to point you in the right direction and to make suggestions, but they won’t, of course, complete your assignments for you!
The data used for this assignment consist of records from Intensive Care Unit (ICU) hospital stays in the USA. All patients were adults who were admitted for a wide variety of reasons. ICU stays of less than 48 hours have been excluded.
The source data for the assignment are data made freely available for the 2012 MIT PhysioNet/Computing for Cardiology Challenge. Details are provided here. Training Set A data have been used. The original data has been modified and assembled to suit the purpose of this assignment. While not required for the purposes of this assignment, full details of the preparatory work can be found in the hdat9600_final_assignment_data_preparation file.
The dataframe consists of 120 variables, which are defined as follows:
Use the hyperlinks below to find out more about the clinical meaning of each variable. The first two clinical variables are summary scores that are used to assess patient condition and risk.
The following 36 clinical measures were assessed at multiple timepoints during each patient’s ICU stay. For each of the 36 clinical measures, you are given 3 summary variables: a) The minimum value during the first 24 hours in ICU (_min), b) The maximum value during the first 24 hours in ICU (_max), and c) The difference between the mean and the most extreme values during the first 24 hours in ICU (_diff). For example, for the clinical measure Cholesterol, these three variables are labelled ‘Cholesterol_min’, ‘Cholesterol_max’, and ‘Cholesterol_diff’.
The data frame can be loaded with the following code:
# Getting the path of your current open file
# Extra code to ensure this file imports birth.csv in local directory for everyone
library(rstudioapi)
current_path <- rstudioapi::getActiveDocumentContext()$path
setwd(dirname(current_path ))
icu_patients_df0 <- readRDS("icu_patients_df0.rds")
icu_patients_df1 <- readRDS("icu_patients_df1.rds")
Note: icu_patients_df1 is an imputed (i.e. missing values are ‘derived’) version of icu_patients_df0. This assignment does not concern the methods used for imputation.
In this task, you are required to develop a logistic regression model using the icu_patients_df1 data set which adequately explains or predicts the in_hospital_death variable as the outcome using a subset of the available predictor variables. You should fit a series of models, evaluating each one, before you present your final model. Your final model should not include all the predictor variables, just a small subset of them, which you have selected based on statistical significance and/or background knowledge. It is perfectly acceptable to include predictor variables in your final model which are not statistically significant, as long as you justify their inclusion on medical or physiological grounds (you will not be marked down if your medical justification is not exactly correct or complete, but do you best). Aim for between five and ten predictor variables (slightly more or fewer is OK). You should assess each model you consider for goodness of fit and other relevant statistics to help you choose between them. For your final model, present a set of diagnostic statistics and/or charts and comment on them. You don’t need to do an exhaustive exploratory data analysis of all the variables in the data set, but you should examine those variables that you use in your model. Finally, re-fit your final model to the unimputed data frame (icu_patients_df0.rds) and comment on any differences you find compared to the same model fitted to the imputed data.
**Selecting an initial subset of explanatory variables:
To select a subset of explanatory variables our group of investigators will examine the SAPS1 score and the SOFA score included in the dataset in more detail to ascertain the variables that might be logically associated with increased mortality and poor survival. We will also assess the APACHE score which is commonly used in ICU risk predcition models.
SAPS1 - Simplified Acute Physiology Score is a measure of the severity of disease for patients admitted to ICU. The following measures increases the SAPS1 score:
SOFA - sequential organ failure assessment is a predictor of ICU mortality. The following measures increase the SOFA score: Elevated PaO2/ FiO2 ratio- * Reduced GCS - Nervous system * Reduced MAP - Cardiovascular system * Administration of vasopressors - Cardiovascular system * High Bilirubin - Liver * Low Platelets - Coagulation * High Creatinine - Kidneys * Low Urine - Kidneys
*The APACHE score is commonly used validated risk score for ICU risk prediction. The variables that increase the APACHE score include:
Advanced Age
High or Low Temperature
High or Low MAP
High or Low HR
High or Low Respiratory Rate
High PaO2/FiO2 ratio
High or Low pH
High or Low Na
High or Low K
High Creatinine
High or low HCT
High or Low WBC
For our analysis, we will include variables that will increase SOFA, SAPS or APACHE scores. eg: increased BUN and reduced HCO3 will increase the SAPS score, therfore we will include BUN max(but not BUN_min and BUN_diff) and HCO3_min (but not HCO3_max and HCO3_diff). Where both extremes of a variable will increase the risk score, both min and max variables will be included.
Other factors known to be associated with morbidity/ mortality not included in risk scores:
BELOW IS A LIST OF THE VARIABLES TO BE INCLUDED: DEMOGRAPHIC VARAIBLES: * Age * Gender * ICU Type * Height * Weight_max
CLINICAL VARIABLES: * Albumin_min * Bilirubin_max * BUN_max * Creatinine_max
* GCS_min * Glucose_min and Glucose_max * HCO3_min * HR_min and HR_max * K_min K_max * Lactate_max * MAP_min
* Na_min and Na_max * NISysABP_min and NISysABP_max * Platelets_min * FiO2_max and PaO2_min - included as PFratio: PaO2_min/ FiO2_max * pH_min and pH_max * RespRate_min and RespRate_max * Temp_min and Temp_max * TroponinI_max * TroponinT_max * Urine_min * WBC_min and WBC_max
summary(icu_patients_df1)
## RecordID Length_of_stay SAPS1 SOFA
## Min. :132539 Min. : -1.00 Min. : 1.00 Min. :-1.000
## 1st Qu.:133875 1st Qu.: 6.00 1st Qu.:11.00 1st Qu.: 3.000
## Median :135146 Median : 10.00 Median :15.00 Median : 6.000
## Mean :135156 Mean : 13.74 Mean :14.96 Mean : 6.441
## 3rd Qu.:136477 3rd Qu.: 17.00 3rd Qu.:19.00 3rd Qu.: 9.000
## Max. :137740 Max. :154.00 Max. :34.00 Max. :22.000
## NA's :96
## Survival in_hospital_death Days Status
## Min. : 0.0 Min. :0.0000 Min. : 0 Mode :logical
## 1st Qu.: 10.0 1st Qu.:0.0000 1st Qu.: 265 FALSE:1288
## Median : 68.0 Median :0.0000 Median :2408 TRUE :773
## Mean : 343.1 Mean :0.1441 Mean :1634
## 3rd Qu.: 420.0 3rd Qu.:0.0000 3rd Qu.:2408
## Max. :2408.0 Max. :1.0000 Max. :2408
## NA's :1288
## Age Albumin_diff Albumin_max Albumin_min
## Min. :16.00 Min. :0.01866 Min. :1.100 Min. :1.100
## 1st Qu.:52.00 1st Qu.:0.28134 1st Qu.:2.600 1st Qu.:2.600
## Median :67.00 Median :0.48134 Median :3.000 Median :3.000
## Mean :64.41 Mean :0.56829 Mean :3.045 Mean :3.012
## 3rd Qu.:78.00 3rd Qu.:0.81866 3rd Qu.:3.500 3rd Qu.:3.500
## Max. :90.00 Max. :2.31866 Max. :5.300 Max. :5.300
##
## ALP_diff ALP_max ALP_min ALT_diff
## Min. : 0.148 Min. : 19.0 Min. : 19.0 Min. : 0.446
## 1st Qu.: 21.852 1st Qu.: 57.0 1st Qu.: 58.0 1st Qu.: 89.446
## Median : 37.852 Median : 78.0 Median : 76.0 Median : 102.446
## Mean : 56.259 Mean : 105.7 Mean : 101.4 Mean : 154.873
## 3rd Qu.: 54.852 3rd Qu.: 110.0 3rd Qu.: 105.0 3rd Qu.: 108.446
## Max. :1408.148 Max. :1504.0 Max. :1339.0 Max. :10319.554
##
## ALT_max ALT_min AST_diff AST_max
## Min. : 3.0 Min. : 1.0 Min. : 0.647 Min. : 5.0
## 1st Qu.: 17.0 1st Qu.: 17.0 1st Qu.: 123.353 1st Qu.: 27.0
## Median : 30.0 Median : 30.0 Median : 142.353 Median : 51.0
## Mean : 118.3 Mean : 90.1 Mean : 227.991 Mean : 188.1
## 3rd Qu.: 69.0 3rd Qu.: 69.0 3rd Qu.: 152.353 3rd Qu.: 130.0
## Max. :10440.0 Max. :9240.0 Max. :15870.647 Max. :16040.0
##
## AST_min Bilirubin_diff Bilirubin_max Bilirubin_min
## Min. : 5.0 Min. : 0.03596 Min. : 0.100 Min. : 0.100
## 1st Qu.: 24.0 1st Qu.: 1.06404 1st Qu.: 0.400 1st Qu.: 0.400
## Median : 42.0 Median : 1.36404 Median : 0.700 Median : 0.600
## Mean : 116.4 Mean : 1.97637 Mean : 1.739 Mean : 1.568
## 3rd Qu.: 87.0 3rd Qu.: 1.46404 3rd Qu.: 1.300 3rd Qu.: 1.100
## Max. :7960.0 Max. :44.13596 Max. :45.900 Max. :45.500
##
## BUN_diff BUN_max BUN_min Cholesterol_diff
## Min. : 0.4729 Min. : 3.00 Min. : 2.00 Min. : 0.5772
## 1st Qu.: 7.4729 1st Qu.: 14.00 1st Qu.: 12.00 1st Qu.: 17.5772
## Median : 11.5270 Median : 20.00 Median : 18.00 Median : 34.4228
## Mean : 15.7904 Mean : 27.48 Mean : 24.44 Mean : 37.2723
## 3rd Qu.: 16.5270 3rd Qu.: 33.00 3rd Qu.: 29.00 3rd Qu.: 55.4228
## Max. :172.4729 Max. :197.00 Max. :157.00 Max. :173.5772
##
## Cholesterol_max Cholesterol_min Creatinine_diff Creatinine_max
## Min. : 59.0 Min. : 59 Min. : 0.03245 Min. : 0.200
## 1st Qu.:122.0 1st Qu.:121 1st Qu.: 0.33245 1st Qu.: 0.800
## Median :152.0 Median :152 Median : 0.53245 Median : 1.000
## Mean :153.4 Mean :153 Mean : 0.86298 Mean : 1.499
## 3rd Qu.:181.0 3rd Qu.:179 3rd Qu.: 0.73245 3rd Qu.: 1.500
## Max. :330.0 Max. :330 Max. :20.76755 Max. :22.000
##
## Creatinine_min DiasABP_diff DiasABP_max DiasABP_min
## Min. : 0.200 Min. : 0.5442 Min. : 22.00 Min. : 2.00
## 1st Qu.: 0.700 1st Qu.: 16.5442 1st Qu.: 68.00 1st Qu.: 40.00
## Median : 0.900 Median : 21.5442 Median : 77.00 Median : 46.00
## Mean : 1.319 Mean : 24.5299 Mean : 78.24 Mean : 46.56
## 3rd Qu.: 1.300 3rd Qu.: 28.4558 3rd Qu.: 86.00 3rd Qu.: 52.00
## Max. :14.100 Max. :209.4558 Max. :268.00 Max. :258.00
## NA's :715 NA's :715 NA's :715
## FiO2_diff FiO2_max FiO2_min GCS_diff
## Min. :0.00192 Min. :0.2800 Min. :0.2800 Min. :0.244
## 1st Qu.:0.15192 1st Qu.:0.5000 1st Qu.:0.4000 1st Qu.:3.756
## Median :0.44808 Median :1.0000 Median :0.4000 Median :3.756
## Mean :0.31376 Mean :0.7874 Mean :0.4863 Mean :5.183
## 3rd Qu.:0.44808 3rd Qu.:1.0000 3rd Qu.:0.5000 3rd Qu.:8.244
## Max. :0.44808 Max. :1.0000 Max. :1.0000 Max. :8.244
##
## GCS_max GCS_min Gender Glucose_diff
## Min. : 3.00 Min. : 3.000 Female: 913 Min. : 0.1445
## 1st Qu.:11.00 1st Qu.: 3.000 Male :1148 1st Qu.: 23.8555
## Median :15.00 Median : 8.000 Median : 39.1445
## Mean :12.87 Mean : 8.773 Mean : 57.0844
## 3rd Qu.:15.00 3rd Qu.:14.000 3rd Qu.: 61.8555
## Max. :15.00 Max. :15.000 Max. :1003.1445
##
## Glucose_max Glucose_min HCO3_diff HCO3_max
## Min. : 39.0 Min. : 24.0 Min. : 0.2275 Min. : 9.00
## 1st Qu.: 117.0 1st Qu.: 98.0 1st Qu.: 1.7725 1st Qu.:22.00
## Median : 141.0 Median :117.0 Median : 3.2275 Median :24.00
## Mean : 163.3 Mean :124.8 Mean : 4.1506 Mean :24.27
## 3rd Qu.: 180.0 3rd Qu.:141.0 3rd Qu.: 5.2275 3rd Qu.:27.00
## Max. :1143.0 Max. :632.0 Max. :24.2275 Max. :47.00
##
## HCO3_min HCT_diff HCT_max HCT_min
## Min. : 5.00 Min. : 0.06013 Min. :21.20 Min. : 9.00
## 1st Qu.:20.00 1st Qu.: 2.96013 1st Qu.:30.00 1st Qu.:26.20
## Median :23.00 Median : 5.16013 Median :33.10 Median :29.60
## Mean :22.43 Mean : 5.70366 Mean :33.57 Mean :30.08
## 3rd Qu.:25.00 3rd Qu.: 7.66013 3rd Qu.:36.70 3rd Qu.:33.70
## Max. :44.00 Max. :23.43987 Max. :54.40 Max. :50.60
##
## Height HR_diff HR_max HR_min
## Min. : 13.0 Min. : 0.9221 Min. : 44.0 Min. : 0.00
## 1st Qu.:162.6 1st Qu.: 20.0779 1st Qu.: 91.0 1st Qu.: 61.00
## Median :170.2 Median : 27.0779 Median :104.0 Median : 71.00
## Mean :170.0 Mean : 30.4294 Mean :106.6 Mean : 71.99
## 3rd Qu.:177.8 3rd Qu.: 36.9221 3rd Qu.:119.0 3rd Qu.: 81.00
## Max. :426.7 Max. :212.9221 Max. :300.0 Max. :126.00
## NA's :992
## ICUType K_diff K_max
## Coronary Care Unit :297 Min. : 0.03521 Min. : 2.500
## Cardiac Surgery Recovery Unit:448 1st Qu.: 0.33521 1st Qu.: 4.000
## Medical ICU :788 Median : 0.56479 Median : 4.300
## Surgical ICU :528 Mean : 0.69010 Mean : 4.419
## 3rd Qu.: 0.86479 3rd Qu.: 4.700
## Max. :18.76479 Max. :22.900
##
## K_min Lactate_diff Lactate_max Lactate_min
## Min. :1.80 Min. : 0.003596 Min. : 0.400 Min. : 0.300
## 1st Qu.:3.50 1st Qu.: 1.096404 1st Qu.: 1.500 1st Qu.: 1.200
## Median :3.90 Median : 1.503596 Median : 2.200 Median : 1.600
## Mean :3.95 Mean : 1.753380 Mean : 2.773 Mean : 1.899
## 3rd Qu.:4.30 3rd Qu.: 1.896404 3rd Qu.: 3.200 3rd Qu.: 2.200
## Max. :6.90 Max. :26.503596 Max. :29.300 Max. :24.200
##
## MAP_diff MAP_max MAP_min Mg_diff
## Min. : 0.2316 Min. : 4.0 Min. : 1.00 Min. :0.0157
## 1st Qu.: 21.7684 1st Qu.: 94.0 1st Qu.: 55.00 1st Qu.:0.1843
## Median : 29.2316 Median :104.0 Median : 61.00 Median :0.3157
## Mean : 38.4735 Mean :111.8 Mean : 62.76 Mean :0.4181
## 3rd Qu.: 41.2316 3rd Qu.:117.0 3rd Qu.: 70.00 3rd Qu.:0.5843
## Max. :213.2316 Max. :291.0 Max. :265.00 Max. :7.9157
##
## Mg_max Mg_min Na_diff Na_max
## Min. :1.100 Min. :0.600 Min. : 0.2066 Min. :112.0
## 1st Qu.:1.900 1st Qu.:1.600 1st Qu.: 1.7934 1st Qu.:137.0
## Median :2.100 Median :1.800 Median : 3.2066 Median :140.0
## Mean :2.153 Mean :1.857 Mean : 4.1146 Mean :139.8
## 3rd Qu.:2.400 3rd Qu.:2.100 3rd Qu.: 5.2066 3rd Qu.:142.0
## Max. :9.900 Max. :6.200 Max. :41.2066 Max. :177.0
##
## Na_min NIDiasABP_diff NIDiasABP_max NIDiasABP_min
## Min. : 98 Min. : 0.491 Min. : 29.00 Min. :10.00
## 1st Qu.:136 1st Qu.: 17.509 1st Qu.: 64.00 1st Qu.:33.00
## Median :138 Median : 25.500 Median : 76.00 Median :42.00
## Mean :138 Mean : 26.964 Mean : 76.92 Mean :43.17
## 3rd Qu.:141 3rd Qu.: 33.509 3rd Qu.: 89.00 3rd Qu.:52.00
## Max. :160 Max. :116.509 Max. :174.00 Max. :97.00
## NA's :455 NA's :455 NA's :455
## NIMAP_diff NIMAP_max NIMAP_min NISysABP_diff
## Min. : 0.0407 Min. : 47.33 Min. : 7.00 Min. : 0.3013
## 1st Qu.: 18.2893 1st Qu.: 81.08 1st Qu.: 52.33 1st Qu.: 25.6987
## Median : 24.7107 Median : 93.67 Median : 60.00 Median : 34.3013
## Mean : 26.9759 Mean : 94.47 Mean : 61.69 Mean : 37.7962
## 3rd Qu.: 33.2893 3rd Qu.:106.00 3rd Qu.: 70.00 3rd Qu.: 45.6987
## Max. :113.2893 Max. :189.00 Max. :121.00 Max. :157.3013
## NA's :455 NA's :455 NA's :455 NA's :453
## NISysABP_max NISysABP_min PaCO2_diff PaCO2_max
## Min. : 78.0 Min. : 4.00 Min. : 0.3358 Min. :16.00
## 1st Qu.:121.0 1st Qu.: 83.00 1st Qu.: 5.6642 1st Qu.:39.00
## Median :138.0 Median : 95.00 Median : 8.6642 Median :44.00
## Mean :140.5 Mean : 96.55 Mean :10.7463 Mean :45.56
## 3rd Qu.:156.0 3rd Qu.:108.00 3rd Qu.:13.3358 3rd Qu.:50.00
## Max. :274.0 Max. :234.00 Max. :57.6642 Max. :98.00
## NA's :453 NA's :453
## PaCO2_min PaO2_diff PaO2_max PaO2_min
## Min. : 0.30 Min. : 0.6179 Min. : 27.0 Min. : 20.0
## 1st Qu.:32.00 1st Qu.: 67.6179 1st Qu.:123.0 1st Qu.: 74.0
## Median :36.00 Median : 90.6179 Median :191.0 Median : 92.0
## Mean :36.72 Mean :119.5407 Mean :223.5 Mean :105.8
## 3rd Qu.:40.00 3rd Qu.:154.3821 3rd Qu.:311.0 3rd Qu.:122.0
## Max. :93.00 Max. :341.3821 Max. :500.0 Max. :477.0
##
## pH_diff pH_max pH_min Platelets_diff
## Min. :0.000114 Min. :7.150 Min. :3.000 Min. : 0.2307
## 1st Qu.:0.059886 1st Qu.:7.380 1st Qu.:7.280 1st Qu.: 39.7693
## Median :0.089886 Median :7.420 Median :7.340 Median : 72.7693
## Mean :0.098486 Mean :7.418 Mean :7.327 Mean : 92.5348
## 3rd Qu.:0.120114 3rd Qu.:7.460 3rd Qu.:7.390 3rd Qu.:116.7693
## Max. :4.369886 Max. :7.690 Max. :7.630 Max. :857.2307
##
## Platelets_max Platelets_min RespRate_diff RespRate_max
## Min. : 18.0 Min. : 9.0 Min. : 0.6514 Min. :13.00
## 1st Qu.: 157.0 1st Qu.:126.0 1st Qu.: 7.3486 1st Qu.:24.00
## Median : 210.0 Median :184.0 Median : 9.6514 Median :27.00
## Mean : 228.9 Mean :197.9 Mean :11.6075 Mean :29.12
## 3rd Qu.: 275.0 3rd Qu.:246.0 3rd Qu.:13.6514 3rd Qu.:33.00
## Max. :1047.0 Max. :891.0 Max. :78.6514 Max. :98.00
##
## RespRate_min SaO2_diff SaO2_max SaO2_min
## Min. : 4.00 Min. : 0.2461 Min. : 75.00 Min. : 33.00
## 1st Qu.:12.00 1st Qu.: 0.7539 1st Qu.: 97.00 1st Qu.: 95.00
## Median :14.00 Median : 1.7539 Median : 98.00 Median : 97.00
## Mean :14.25 Mean : 2.5635 Mean : 97.44 Mean : 95.85
## 3rd Qu.:17.00 3rd Qu.: 3.2461 3rd Qu.: 99.00 3rd Qu.: 98.00
## Max. :24.00 Max. :64.2461 Max. :100.00 Max. :100.00
##
## SysABP_diff SysABP_max SysABP_min Temp_diff
## Min. : 3.689 Min. : 52.0 Min. : 11.00 Min. : 0.1259
## 1st Qu.: 32.310 1st Qu.:135.0 1st Qu.: 79.00 1st Qu.: 0.8741
## Median : 40.690 Median :149.0 Median : 88.00 Median : 1.2741
## Mean : 45.008 Mean :152.1 Mean : 90.91 Mean : 1.3756
## 3rd Qu.: 53.690 3rd Qu.:167.0 3rd Qu.:102.00 3rd Qu.: 1.7259
## Max. :178.690 Max. :295.0 Max. :262.00 Max. :12.7741
## NA's :715 NA's :715 NA's :715
## Temp_max Temp_min TroponinI_diff TroponinI_max
## Min. :35.40 Min. :24.20 Min. : 0.1571 Min. : 0.30
## 1st Qu.:37.10 1st Qu.:35.60 1st Qu.: 4.6429 1st Qu.: 2.60
## Median :37.60 Median :36.10 Median : 5.2571 Median : 7.80
## Mean :37.69 Mean :36.01 Mean :10.1737 Mean :11.83
## 3rd Qu.:38.20 3rd Qu.:36.60 3rd Qu.:12.1571 3rd Qu.:17.60
## Max. :42.10 Max. :38.30 Max. :37.9571 Max. :43.40
##
## TroponinI_min TroponinT_diff TroponinT_max TroponinT_min
## Min. : 0.30 Min. : 0.0215 Min. : 0.0100 Min. : 0.0100
## 1st Qu.: 1.30 1st Qu.: 0.5785 1st Qu.: 0.0600 1st Qu.: 0.0400
## Median : 6.80 Median : 0.6285 Median : 0.1700 Median : 0.1200
## Mean :10.06 Mean : 1.0920 Mean : 0.9079 Mean : 0.6347
## 3rd Qu.:13.20 3rd Qu.: 0.6585 3rd Qu.: 0.8000 3rd Qu.: 0.4700
## Max. :42.90 Max. :23.7915 Max. :24.4600 Max. :22.9300
##
## Urine_diff Urine_max Urine_min WBC_diff
## Min. : 19.22 Min. : 0.0 Min. : 0.00 Min. : 0.03315
## 1st Qu.: 100.78 1st Qu.: 200.0 1st Qu.: 0.00 1st Qu.: 2.63315
## Median : 300.78 Median : 400.0 Median : 20.00 Median : 4.53315
## Mean : 438.25 Mean : 521.8 Mean : 34.55 Mean : 5.82079
## 3rd Qu.: 525.78 3rd Qu.: 625.0 3rd Qu.: 36.00 3rd Qu.: 7.23315
## Max. :4900.78 Max. :5000.0 Max. :600.00 Max. :143.46685
##
## WBC_max WBC_min Weight_diff Weight_max
## Min. : 0.10 Min. : 0.10 Min. : 0.00012 Min. : 34.60
## 1st Qu.: 9.30 1st Qu.: 7.60 1st Qu.: 7.60000 1st Qu.: 66.00
## Median : 12.30 Median : 10.40 Median : 14.70012 Median : 80.00
## Mean : 13.95 Mean : 11.51 Mean : 18.17040 Mean : 82.66
## 3rd Qu.: 16.90 3rd Qu.: 14.10 3rd Qu.: 24.80000 3rd Qu.: 94.55
## Max. :155.60 Max. :128.30 Max. :149.30012 Max. :230.00
## NA's :146 NA's :146
## Weight_min
## Min. : 34.60
## 1st Qu.: 65.00
## Median : 77.70
## Mean : 80.86
## 3rd Qu.: 91.95
## Max. :230.00
## NA's :146
head(icu_patients_df1)
## RecordID Length_of_stay SAPS1 SOFA Survival in_hospital_death Days Status Age
## 1 132539 5 6 1 NA 0 2408 FALSE 54
## 2 132540 8 16 8 NA 0 2408 FALSE 76
## 3 132541 19 21 11 NA 0 2408 FALSE 44
## 4 132543 9 7 1 575 0 575 TRUE 68
## 5 132545 4 17 2 918 0 918 TRUE 88
## 6 132547 6 14 11 1637 0 1637 TRUE 64
## Albumin_diff Albumin_max Albumin_min ALP_diff ALP_max ALP_min ALT_diff
## 1 0.2186633 3.2 3.1 118.147964 214 202 80.44617
## 2 0.8813367 2.1 2.2 252.147964 338 348 94.44617
## 3 0.6813367 2.7 2.3 31.147964 127 105 45.44617
## 4 1.4186633 4.4 4.4 9.147964 105 105 108.44617
## 5 0.3813367 2.7 2.6 56.852036 39 78 96.44617
## 6 0.4186633 3.4 3.3 5.147964 101 101 75.44617
## ALT_max ALT_min AST_diff AST_max AST_min Bilirubin_diff Bilirubin_max
## 1 40 75 131.35271 38 53 1.464039 0.4
## 2 206 26 116.35271 53 74 1.564039 1.2
## 3 91 75 65.64729 235 164 1.235961 3.0
## 4 12 12 154.35271 15 15 1.564039 0.2
## 5 24 32 154.35271 15 97 1.364039 0.4
## 6 60 45 122.35271 162 47 1.364039 0.4
## Bilirubin_min BUN_diff BUN_max BUN_min Cholesterol_diff Cholesterol_max
## 1 0.3 11.527053 13 13 16.42276 154
## 2 0.2 8.527053 18 16 28.42276 139
## 3 2.8 21.527053 8 3 56.42276 111
## 4 0.2 4.527053 23 20 37.42276 127
## 5 0.9 20.472947 45 45 55.42276 104
## 6 0.4 9.527053 19 15 55.57724 212
## Cholesterol_min Creatinine_diff Creatinine_max Creatinine_min DiasABP_diff
## 1 140 0.4324463 0.8 0.8 NA
## 2 128 0.4324463 1.2 0.8 26.54421
## 3 100 0.9324463 0.4 0.3 NA
## 4 119 0.5324463 0.9 0.7 NA
## 5 101 0.2324463 1.0 1.0 NA
## 6 212 0.3324463 1.4 0.9 20.45579
## DiasABP_max DiasABP_min FiO2_diff FiO2_max FiO2_min GCS_diff GCS_max GCS_min
## 1 NA NA 0.05192012 0.5 0.5 3.755971 15 15
## 2 81 32 0.44807988 1.0 0.4 8.244029 15 3
## 3 NA NA 0.44807988 1.0 0.5 6.244029 8 5
## 4 NA NA 0.44807988 1.0 0.4 3.755971 15 14
## 5 NA NA 0.15192012 0.4 0.5 3.755971 15 15
## 6 79 55 0.05192012 0.5 0.5 4.244029 9 7
## Gender Glucose_diff Glucose_max Glucose_min HCO3_diff HCO3_max HCO3_min
## 1 Female 65.14446 205 205 3.227452 26 26
## 2 Male 34.85554 105 105 1.772548 22 21
## 3 Female 20.85554 141 119 3.227452 26 24
## 4 Male 33.85554 129 106 5.227452 28 27
## 5 Female 26.85554 113 113 4.772548 18 18
## 6 Male 124.14446 264 197 3.772548 19 19
## HCT_diff HCT_max HCT_min Height HR_diff HR_max HR_min
## 1 2.739871 33.7 33.5 NA 29.077891 80 58
## 2 6.260129 29.7 24.7 175.3 7.077891 88 80
## 3 4.260129 28.5 26.7 NA 30.077891 113 57
## 4 10.339871 41.3 36.1 180.3 30.077891 88 57
## 5 8.360129 30.8 22.6 NA 20.077891 94 67
## 6 10.639871 41.6 36.8 180.3 16.077891 91 71
## ICUType K_diff K_max K_min Lactate_diff Lactate_max
## 1 Surgical ICU 0.2647934 4.4 4.4 0.9964037 1.9
## 2 Cardiac Surgery Recovery Unit 0.1647934 4.3 4.3 1.4964037 2.9
## 3 Medical ICU 4.4647934 8.6 3.3 1.4964037 1.9
## 4 Medical ICU 0.1352066 4.2 4.0 1.5964037 1.2
## 5 Medical ICU 1.8647934 6.0 3.8 0.8964037 2.0
## 6 Coronary Care Unit 0.9647934 5.1 3.8 1.8964037 0.9
## Lactate_min MAP_diff MAP_max MAP_min Mg_diff Mg_max Mg_min Na_diff Na_max
## 1 1.8 31.23164 109 56 0.4842982 1.5 1.5 2.2066071 137
## 2 1.3 34.76836 100 43 1.1157018 3.1 1.9 0.2066071 139
## 3 1.3 53.23164 131 71 0.6842982 1.9 1.3 2.2066071 140
## 4 1.5 24.23164 102 72 0.1157018 2.1 2.1 1.7933929 141
## 5 1.9 9.76836 78 68 0.4842982 1.5 1.5 0.7933929 140
## 6 1.3 24.23164 102 62 0.2842982 1.7 1.7 2.2066071 141
## Na_min NIDiasABP_diff NIDiasABP_max NIDiasABP_min NIMAP_diff NIMAP_max
## 1 137 17.49101 65 40 17.04069 92.33
## 2 139 19.49101 65 38 26.38069 86.33
## 3 137 37.50899 95 66 34.28931 110.00
## 4 140 23.50899 81 54 24.98931 100.70
## 5 140 38.50899 96 29 29.98931 105.70
## 6 137 31.50899 89 52 26.58931 102.30
## NIMAP_min NISysABP_diff NISysABP_max NISysABP_min PaCO2_diff PaCO2_max
## 1 58.67 40.30125 157 96 3.335797 37
## 2 49.33 44.69875 129 72 7.335797 41
## 3 83.33 33.30125 150 111 3.335797 37
## 4 73.00 23.30125 140 102 9.335797 38
## 5 63.67 39.30125 156 119 6.335797 34
## 6 61.67 35.69875 129 81 5.335797 45
## PaCO2_min PaO2_diff PaO2_max PaO2_min pH_diff pH_max pH_min Platelets_diff
## 1 38 47.61789 186 111 0.12011376 7.49 7.43 31.23069
## 2 33 286.38211 445 89 0.08011376 7.45 7.34 36.23069
## 3 37 93.61789 65 65 0.14011376 7.51 7.51 117.76931
## 4 31 94.61789 148 64 0.14011376 7.51 7.47 201.23069
## 5 35 80.61789 78 84 0.04011376 7.38 7.41 80.76931
## 6 35 80.61789 101 78 0.07988624 7.40 7.29 86.23069
## Platelets_max Platelets_min RespRate_diff RespRate_max RespRate_min SaO2_diff
## 1 221 221 7.34858 24 12 3.246079
## 2 226 164 16.65142 36 11 1.753921
## 3 84 72 13.65142 33 18 2.246079
## 4 391 315 7.34858 21 12 1.753921
## 5 109 109 6.65142 26 15 3.246079
## 6 276 219 27.65142 47 20 1.246079
## SaO2_max SaO2_min SysABP_diff SysABP_max SysABP_min Temp_diff Temp_max
## 1 98 94 NA NA NA 1.874083 38.1
## 2 99 97 50.3105 135 66 2.474083 37.9
## 3 95 95 NA NA NA 2.025917 39.0
## 4 99 97 NA NA NA 1.874083 36.7
## 5 97 94 NA NA NA 1.174083 37.8
## 6 97 96 43.3105 152 73 1.174083 37.8
## Temp_min TroponinI_diff TroponinI_max TroponinI_min TroponinT_diff
## 1 35.1 5.1429448 1.0 0.3 0.4785006
## 2 34.5 26.2570552 31.7 16.1 0.6485006
## 3 36.7 31.2570552 33.4 36.7 0.8814994
## 4 35.1 0.8570552 5.9 6.3 0.6485006
## 5 35.8 0.1570552 5.6 5.6 0.6085006
## 6 35.8 4.1429448 1.3 1.3 0.6385006
## TroponinT_max TroponinT_min Urine_diff Urine_max Urine_min WBC_diff WBC_max
## 1 0.58 0.19 800.78242 900 30 0.9331524 11.2
## 2 0.43 0.02 670.78242 770 0 4.7331524 13.1
## 3 1.55 1.41 310.78242 410 30 8.4331524 4.2
## 4 0.10 0.02 600.78242 700 100 3.3331524 11.5
## 5 0.06 0.37 83.21758 150 16 8.3331524 3.8
## 6 0.03 0.10 1100.78242 1200 40 11.8668476 24.0
## WBC_min Weight_diff Weight_max Weight_min
## 1 11.2 NA NA NA
## 2 7.4 4.699878 80.6 76.0
## 3 3.7 23.999878 56.7 56.7
## 4 8.8 3.900122 84.6 84.6
## 5 3.8 NA NA NA
## 6 14.4 33.300122 114.0 114.0
library(ggplot2)
library(gridExtra)
#################################################################################
### CODE COPIED FROM TASK 2
# create new variable PF ratio as part of our list of variables to include
icu_patients_df1$PFratio<-icu_patients_df1$PaO2_min/icu_patients_df1$FiO2_max
### CODE COPIED FROM TASK 2
#################################################################################
summary(icu_patients_df1$Height) #max height is 426.7cm!? and min is 13.0cm - seems wrong
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 13.0 162.6 170.2 170.0 177.8 426.7 992
# Basic EDA for each variable
table(icu_patients_df1$in_hospital_death) #297 deaths out of 2016 observations = 14.4%
##
## 0 1
## 1764 297
# Write a function to plot box plots for each variable by in_hospital_death
boxplot_eda <- function(variable){
plot <- ggplot(data=icu_patients_df1,
mapping = aes(x = in_hospital_death=="1",
y = icu_patients_df1[,variable])) +
geom_boxplot() +
labs(title=paste('Box plot of',variable),
x='In hospital death', y=variable)
return(plot)
}
### Continuous variables EDA and their interpretation ###
#################################################################################
### CODE COPIED FROM TASK 2
# continuous variables from the list of initial subset of explanatory variables
cont_vars <- c('Age', 'Height', 'Weight_max', 'Albumin_min', 'Bilirubin_max',
'BUN_max', 'Creatinine_max', 'GCS_min', 'Glucose_min',
'Glucose_max', 'HCO3_min', 'HR_min', 'HR_max', 'K_min', 'K_max',
'Lactate_max', 'MAP_min', 'Na_min', 'Na_max', 'NISysABP_min',
'NISysABP_max', 'Platelets_min', 'PFratio', 'pH_min', 'pH_max',
'RespRate_min', 'RespRate_max', 'Temp_min', 'Temp_max',
'TroponinI_max', 'TroponinT_max', 'Urine_min', 'WBC_min', 'WBC_max')
### CODE COPIED FROM TASK 2
#################################################################################
# Loop through the continuous variables and produce box plots using the boxplot_eda() function
b <- list() # initialise an empty list to store the plots in
for(i in 1:length(cont_vars)){
b[[i]] <- boxplot_eda(cont_vars[i])
}
# arrange the list of plots in a 12 row grid using grid.arrange() from package{gridExtra}
do.call(grid.arrange, c(b, nrow = 12))
## Warning: Removed 992 rows containing non-finite values (stat_boxplot).
## Warning: Removed 146 rows containing non-finite values (stat_boxplot).
## Warning: Removed 453 rows containing non-finite values (stat_boxplot).
## Warning: Removed 453 rows containing non-finite values (stat_boxplot).
# Higher age in those that died
# Some extreme illogical outliers in height variable
# Similar weight median / IQR in both groups, but more high outliers in the alive group
# Higher min albumin in those that died
# Slightly higher max bilirubin in those that died
# Higher max urea in those that died
# Higher max creatinine in those that died
# Lower GCS min in those that died
# Similar min glucose in both groups
# Slightly higher max glucose in those that died
# Lower min HCO3 in those that died
# Similar min HR in both groups
# Slightly higher max HR in those that died
# Similar min K in both groups
# Similar max K in both groups
# Slightly higher max lactate in those that died
# Similar min MAP in both groups
# Similar min Na in both groups
# Similar max Na in both groups
# Slightly lower min NISysABP in those that died
# Similar max NISysABP in both groups
# Similar min platelets in both groups
# Similar PF ratio in both groups
# Similar min pH in both groups - one extreme outlier
# Similar pH max in both groups
# Higher min RR in those that died
# Higher max RR in those that died
# Similar min temp in both groups
# Similar max temp in both groups
# Similar max troponinI in both groups
# Similar max troponinT in both groups
# Similar min urine in both groups
# Slightly higher min WBC in those that died
# Slightly higher max WBC in those that died
## had to split this chunk into two to allow making the big grid figure larger without affecting the others ##
# Patients who died had higher SAPS1 and SOFA scores
ggplot(data=icu_patients_df1,
mapping = aes(x = in_hospital_death=="1", y = SAPS1)) + geom_boxplot() +
labs(title=paste('Box plot of SAPS1 scores'),
x='In hospital death', y='SAPS1 score')
## Warning: Removed 96 rows containing non-finite values (stat_boxplot).
ggplot(data=icu_patients_df1,
mapping = aes(x = in_hospital_death=="1", y = SOFA)) + geom_boxplot() +
labs(title=paste('Box plot of SOFA scores'),
x='In hospital death', y='SOFA score')
### Categorical variables EDA and their interpretation ###
# cardiac surgery recovery unit have a smaller death circle compared to the other 3 ICU units
# ie less proportion of in hospital deaths compared to alive
icutype_plot <- ggplot(data=icu_patients_df1,
mapping = aes(x = in_hospital_death=="1", y = ICUType)) +
geom_count(aes(size = after_stat(prop), group = ICUType)) +
scale_size_area(max_size = 10) +
labs(title=paste('Proportion of patients by ICU type'),
x='In hospital death', size='Proportion of patients')
# difficult to say, roughly same amount of men/women died as a proportion of the alive group
gender_plot <- ggplot(data=icu_patients_df1,
mapping = aes(x = in_hospital_death=="1", y = Gender)) +
geom_count(aes(size = after_stat(prop), group = ICUType)) +
scale_size_area(max_size = 20) +
labs(title=paste('Proportion of patients by gender'),
x='In hospital death', size='Proportion of patients')
# arrange the categorical variable plots side-by-side
grid.arrange(icutype_plot, gender_plot, nrow=1)
# univariate comparisons above
# removed: Mg_min, Na_min, Na_max, MAP_diff, MAP_max
# now in order as per above list
age_glm <- glm(in_hospital_death ~ Age, data=icu_patients_df1, family="binomial")
summary(age_glm) # is significant
##
## Call:
## glm(formula = in_hospital_death ~ Age, family = "binomial", data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.7522 -0.6264 -0.5111 -0.3919 2.5135
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -3.761624 0.303337 -12.401 < 2e-16 ***
## Age 0.029376 0.004229 6.947 3.73e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1644.9 on 2059 degrees of freedom
## AIC: 1648.9
##
## Number of Fisher Scoring iterations: 5
gender_glm <- glm(in_hospital_death ~ Gender, data=icu_patients_df1, family="binomial")
summary(gender_glm) # NOT significant
##
## Call:
## glm(formula = in_hospital_death ~ Gender, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.5612 -0.5612 -0.5553 -0.5553 1.9728
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.76894 0.09381 -18.856 <2e-16 ***
## GenderMale -0.02281 0.12615 -0.181 0.856
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1699.7 on 2059 degrees of freedom
## AIC: 1703.7
##
## Number of Fisher Scoring iterations: 4
icuType_glm <- glm(in_hospital_death ~ ICUType, data=icu_patients_df1, family="binomial")
summary(icuType_glm) # cardiac surgery recovery unit is significant
##
## Call:
## glm(formula = in_hospital_death ~ ICUType, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.6402 -0.6402 -0.5615 -0.3458 2.3861
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.6463 0.1576 -10.443 < 2e-16 ***
## ICUTypeCardiac Surgery Recovery Unit -1.1407 0.2563 -4.451 8.55e-06 ***
## ICUTypeMedical ICU 0.1653 0.1824 0.906 0.365
## ICUTypeSurgical ICU -0.1214 0.2001 -0.607 0.544
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1655.3 on 2057 degrees of freedom
## AIC: 1663.3
##
## Number of Fisher Scoring iterations: 5
# height variable not used
maxWeight_glm <- glm(in_hospital_death ~ Weight_max, data=icu_patients_df1, family="binomial")
summary(maxWeight_glm) # is significant
##
## Call:
## glm(formula = in_hospital_death ~ Weight_max, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.6460 -0.5846 -0.5605 -0.5231 2.1768
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.246092 0.242568 -5.137 2.79e-07 ***
## Weight_max -0.006212 0.002912 -2.133 0.0329 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1604.2 on 1914 degrees of freedom
## Residual deviance: 1599.4 on 1913 degrees of freedom
## (146 observations deleted due to missingness)
## AIC: 1603.4
##
## Number of Fisher Scoring iterations: 4
minAlbumin_glm <- glm(in_hospital_death ~ Albumin_min, data=icu_patients_df1, family="binomial")
summary(minAlbumin_glm) # is significant
##
## Call:
## glm(formula = in_hospital_death ~ Albumin_min, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.7948 -0.5887 -0.5385 -0.4595 2.2842
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.36392 0.29389 -1.238 0.216
## Albumin_min -0.48186 0.09987 -4.825 1.4e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1676.0 on 2059 degrees of freedom
## AIC: 1680
##
## Number of Fisher Scoring iterations: 4
maxBili_glm <- glm(in_hospital_death ~ Bilirubin_max, data=icu_patients_df1, family="binomial")
summary(maxBili_glm) # is significant
##
## Call:
## glm(formula = in_hospital_death ~ Bilirubin_max, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.3889 -0.5421 -0.5363 -0.5321 2.0174
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.90053 0.06866 -27.679 < 2e-16 ***
## Bilirubin_max 0.05692 0.01135 5.013 5.35e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1676.8 on 2059 degrees of freedom
## AIC: 1680.8
##
## Number of Fisher Scoring iterations: 4
maxUrea_glm <- glm(in_hospital_death ~ BUN_max, data=icu_patients_df1, family="binomial")
summary(maxUrea_glm) # is significant
##
## Call:
## glm(formula = in_hospital_death ~ BUN_max, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.0462 -0.5269 -0.4789 -0.4443 2.2309
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -2.492189 0.103693 -24.034 <2e-16 ***
## BUN_max 0.022610 0.002347 9.634 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1607.3 on 2059 degrees of freedom
## AIC: 1611.3
##
## Number of Fisher Scoring iterations: 4
maxCr_glm <- glm(in_hospital_death ~ Creatinine_max, data=icu_patients_df1, family="binomial")
summary(maxCr_glm) # is significant
##
## Call:
## glm(formula = in_hospital_death ~ Creatinine_max, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.8627 -0.5433 -0.5270 -0.5151 2.0633
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -2.05087 0.08430 -24.328 < 2e-16 ***
## Creatinine_max 0.16325 0.03135 5.208 1.91e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1674.4 on 2059 degrees of freedom
## AIC: 1678.4
##
## Number of Fisher Scoring iterations: 4
minGCS_glm <- glm(in_hospital_death ~ GCS_min, data=icu_patients_df1, family="binomial")
summary(minGCS_glm) # is significant
##
## Call:
## glm(formula = in_hospital_death ~ GCS_min, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.6238 -0.6238 -0.5394 -0.4853 2.0964
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.40261 0.12298 -11.405 < 2e-16 ***
## GCS_min -0.04514 0.01317 -3.426 0.000612 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1687.7 on 2059 degrees of freedom
## AIC: 1691.7
##
## Number of Fisher Scoring iterations: 4
minGlu_glm <- glm(in_hospital_death ~ Glucose_min, data=icu_patients_df1, family="binomial")
summary(minGlu_glm) # NOT significant
##
## Call:
## glm(formula = in_hospital_death ~ Glucose_min, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.7799 -0.5613 -0.5522 -0.5428 2.0271
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.967537 0.171241 -11.490 <2e-16 ***
## Glucose_min 0.001476 0.001253 1.178 0.239
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1698.4 on 2059 degrees of freedom
## AIC: 1702.4
##
## Number of Fisher Scoring iterations: 4
maxGlu_glm <- glm(in_hospital_death ~ Glucose_max, data=icu_patients_df1, family="binomial")
summary(maxGlu_glm) # is significant
##
## Call:
## glm(formula = in_hospital_death ~ Glucose_max, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.4117 -0.5572 -0.5343 -0.5162 2.0872
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -2.1865370 0.1202802 -18.179 < 2e-16 ***
## Glucose_max 0.0023817 0.0005819 4.093 4.25e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1684.2 on 2059 degrees of freedom
## AIC: 1688.2
##
## Number of Fisher Scoring iterations: 4
minHCO3_glm <- glm(in_hospital_death ~ HCO3_min, data=icu_patients_df1, family="binomial")
summary(minHCO3_glm) # is significant
##
## Call:
## glm(formula = in_hospital_death ~ HCO3_min, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.9781 -0.5748 -0.5165 -0.4634 2.6504
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.10497 0.29323 -0.358 0.72
## HCO3_min -0.07675 0.01345 -5.705 1.17e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1666.8 on 2059 degrees of freedom
## AIC: 1670.8
##
## Number of Fisher Scoring iterations: 4
minHR_glm <- glm(in_hospital_death ~ HR_min, data=icu_patients_df1, family="binomial")
summary(minHR_glm) # NOT significant
##
## Call:
## glm(formula = in_hospital_death ~ HR_min, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.6235 -0.5656 -0.5528 -0.5390 2.1087
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -2.108733 0.301434 -6.996 2.64e-12 ***
## HR_min 0.004520 0.004052 1.115 0.265
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1698.4 on 2059 degrees of freedom
## AIC: 1702.4
##
## Number of Fisher Scoring iterations: 4
maxHR_glm <- glm(in_hospital_death ~ HR_max, data=icu_patients_df1, family="binomial")
summary(maxHR_glm) # is significant
##
## Call:
## glm(formula = in_hospital_death ~ HR_max, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.1194 -0.5733 -0.5402 -0.5067 2.1517
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -2.707555 0.303251 -8.928 < 2e-16 ***
## HR_max 0.008565 0.002707 3.164 0.00156 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1689.9 on 2059 degrees of freedom
## AIC: 1693.9
##
## Number of Fisher Scoring iterations: 4
minK_glm <- glm(in_hospital_death ~ K_min, data=icu_patients_df1, family="binomial")
summary(minK_glm) # NOT significant
##
## Call:
## glm(formula = in_hospital_death ~ K_min, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.6024 -0.5647 -0.5546 -0.5447 2.0345
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.47413 0.42361 -3.480 0.000502 ***
## K_min -0.07804 0.10660 -0.732 0.464083
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1699.1 on 2059 degrees of freedom
## AIC: 1703.1
##
## Number of Fisher Scoring iterations: 4
maxK_glm <- glm(in_hospital_death ~ K_max, data=icu_patients_df1, family="binomial")
summary(maxK_glm) # NOT significant
##
## Call:
## glm(formula = in_hospital_death ~ K_max, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.2402 -0.5620 -0.5512 -0.5380 2.0561
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -2.24634 0.28233 -7.956 1.77e-15 ***
## K_max 0.10449 0.06153 1.698 0.0895 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1697.0 on 2059 degrees of freedom
## AIC: 1701
##
## Number of Fisher Scoring iterations: 4
maxLactate_glm <- glm(in_hospital_death ~ Lactate_max, data=icu_patients_df1, family="binomial")
summary(maxLactate_glm) # is significant
##
## Call:
## glm(formula = in_hospital_death ~ Lactate_max, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.1726 -0.5544 -0.5200 -0.4939 2.1212
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -2.1932 0.1005 -21.820 < 2e-16 ***
## Lactate_max 0.1372 0.0244 5.625 1.86e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1669.5 on 2059 degrees of freedom
## AIC: 1673.5
##
## Number of Fisher Scoring iterations: 4
minMAP_glm <- glm(in_hospital_death ~ MAP_min, data=icu_patients_df1, family="binomial")
summary(minMAP_glm) # NOT significant
##
## Call:
## glm(formula = in_hospital_death ~ MAP_min, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.6583 -0.5674 -0.5551 -0.5341 2.4214
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.413112 0.257434 -5.489 4.04e-08 ***
## MAP_min -0.005926 0.004051 -1.463 0.143
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1697.4 on 2059 degrees of freedom
## AIC: 1701.4
##
## Number of Fisher Scoring iterations: 4
minNa_glm <- glm(in_hospital_death ~ Na_min, data=icu_patients_df1, family="binomial")
summary(minNa_glm) # is significant
##
## Call:
## glm(formula = in_hospital_death ~ Na_min, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.9061 -0.5706 -0.5490 -0.5282 2.2298
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.04227 1.79129 1.140 0.2542
## Na_min -0.02776 0.01301 -2.133 0.0329 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1695.3 on 2059 degrees of freedom
## AIC: 1699.3
##
## Number of Fisher Scoring iterations: 4
maxNa_glm <- glm(in_hospital_death ~ Na_max, data=icu_patients_df1, family="binomial")
summary(maxNa_glm) # NOT significant
##
## Call:
## glm(formula = in_hospital_death ~ Na_max, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.6176 -0.5615 -0.5573 -0.5491 2.0760
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.664686 1.927556 -0.345 0.730
## Na_max -0.007993 0.013793 -0.580 0.562
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1699.4 on 2059 degrees of freedom
## AIC: 1703.4
##
## Number of Fisher Scoring iterations: 4
minNISys_ABP_glm <- glm(in_hospital_death ~ NISysABP_min, data=icu_patients_df1, family="binomial")
summary(minNISys_ABP_glm) # is significant
##
## Call:
## glm(formula = in_hospital_death ~ NISysABP_min, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.9728 -0.6135 -0.5731 -0.5005 2.3871
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.450605 0.328983 -1.370 0.170783
## NISysABP_min -0.012922 0.003466 -3.728 0.000193 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1403.1 on 1607 degrees of freedom
## Residual deviance: 1388.5 on 1606 degrees of freedom
## (453 observations deleted due to missingness)
## AIC: 1392.5
##
## Number of Fisher Scoring iterations: 4
maxNISys_ABP_glm <- glm(in_hospital_death ~ NISysABP_max, data=icu_patients_df1, family="binomial")
summary(maxNISys_ABP_glm) # NOT significant
##
## Call:
## glm(formula = in_hospital_death ~ NISysABP_max, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.6098 -0.5886 -0.5846 -0.5799 1.9414
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.7826689 0.3544507 -5.029 4.92e-07 ***
## NISysABP_max 0.0007759 0.0024679 0.314 0.753
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1403.1 on 1607 degrees of freedom
## Residual deviance: 1403.0 on 1606 degrees of freedom
## (453 observations deleted due to missingness)
## AIC: 1407
##
## Number of Fisher Scoring iterations: 3
minPlt_glm <- glm(in_hospital_death ~ Platelets_min, data=icu_patients_df1, family="binomial")
summary(minPlt_glm) # NOT significant
##
## Call:
## glm(formula = in_hospital_death ~ Platelets_min, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.6122 -0.5735 -0.5558 -0.5260 2.2141
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.5693181 0.1352494 -11.603 <2e-16 ***
## Platelets_min -0.0010963 0.0006322 -1.734 0.0829 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1696.6 on 2059 degrees of freedom
## AIC: 1700.6
##
## Number of Fisher Scoring iterations: 4
maxPFratio_glm <- glm(in_hospital_death ~ PFratio, data=icu_patients_df1, family="binomial")
summary(maxPFratio_glm) # NOT significant
##
## Call:
## glm(formula = in_hospital_death ~ PFratio, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.5806 -0.5687 -0.5595 -0.5398 2.1022
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.6790207 0.1148206 -14.623 <2e-16 ***
## PFratio -0.0006772 0.0006452 -1.049 0.294
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1698.5 on 2059 degrees of freedom
## AIC: 1702.5
##
## Number of Fisher Scoring iterations: 4
minpH_glm <- glm(in_hospital_death ~ pH_min, data=icu_patients_df1, family="binomial")
summary(minpH_glm) # is significant
##
## Call:
## glm(formula = in_hospital_death ~ pH_min, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.9980 -0.5733 -0.5358 -0.4868 2.2874
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 19.5912 4.8996 3.998 6.37e-05 ***
## pH_min -2.9197 0.6699 -4.358 1.31e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1677.4 on 2059 degrees of freedom
## AIC: 1681.4
##
## Number of Fisher Scoring iterations: 4
maxpH_glm <- glm(in_hospital_death ~ pH_max, data=icu_patients_df1, family="binomial")
summary(maxpH_glm) # NOT significant
##
## Call:
## glm(formula = in_hospital_death ~ pH_max, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.6684 -0.5677 -0.5523 -0.5297 2.0743
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 9.3001 7.0197 1.325 0.185
## pH_max -1.4944 0.9469 -1.578 0.115
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1697.2 on 2059 degrees of freedom
## AIC: 1701.2
##
## Number of Fisher Scoring iterations: 4
minRR_glm <- glm(in_hospital_death ~ RespRate_min, data=icu_patients_df1, family="binomial")
summary(minRR_glm) # is significant
##
## Call:
## glm(formula = in_hospital_death ~ RespRate_min, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.7929 -0.5872 -0.5222 -0.4636 2.3445
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -3.01958 0.25802 -11.703 < 2e-16 ***
## RespRate_min 0.08432 0.01656 5.091 3.57e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1673.6 on 2059 degrees of freedom
## AIC: 1677.6
##
## Number of Fisher Scoring iterations: 4
maxRR_glm <- glm(in_hospital_death ~ RespRate_max, data=icu_patients_df1, family="binomial")
summary(maxRR_glm) # is significant
##
## Call:
## glm(formula = in_hospital_death ~ RespRate_max, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.4489 -0.5679 -0.5233 -0.4817 2.1771
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -2.835656 0.235885 -12.021 < 2e-16 ***
## RespRate_max 0.035250 0.007412 4.756 1.98e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1677.8 on 2059 degrees of freedom
## AIC: 1681.8
##
## Number of Fisher Scoring iterations: 4
minTemp_glm <- glm(in_hospital_death ~ Temp_min, data=icu_patients_df1, family="binomial")
summary(minTemp_glm) # is significant
##
## Call:
## glm(formula = in_hospital_death ~ Temp_min, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.8918 -0.5741 -0.5409 -0.4973 2.2040
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 7.4599 2.3473 3.178 0.00148 **
## Temp_min -0.2571 0.0654 -3.931 8.45e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1684.3 on 2059 degrees of freedom
## AIC: 1688.3
##
## Number of Fisher Scoring iterations: 4
maxTemp_glm <- glm(in_hospital_death ~ Temp_max, data=icu_patients_df1, family="binomial")
summary(maxTemp_glm) # NOT significant
##
## Call:
## glm(formula = in_hospital_death ~ Temp_max, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.6077 -0.5689 -0.5549 -0.5366 2.1386
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.60419 3.08152 0.521 0.603
## Temp_max -0.08988 0.08183 -1.098 0.272
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1698.5 on 2059 degrees of freedom
## AIC: 1702.5
##
## Number of Fisher Scoring iterations: 4
maxTropI_glm <- glm(in_hospital_death ~ TroponinI_max, data=icu_patients_df1, family="binomial")
summary(maxTropI_glm) # NOT significant
##
## Call:
## glm(formula = in_hospital_death ~ TroponinI_max, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.5736 -0.5688 -0.5565 -0.5350 2.0415
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.719798 0.090789 -18.943 <2e-16 ***
## TroponinI_max -0.005329 0.005774 -0.923 0.356
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1698.8 on 2059 degrees of freedom
## AIC: 1702.8
##
## Number of Fisher Scoring iterations: 4
maxTropT_glm <- glm(in_hospital_death ~ TroponinT_max, data=icu_patients_df1, family="binomial")
summary(maxTropT_glm) # is significant
##
## Call:
## glm(formula = in_hospital_death ~ TroponinT_max, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.0740 -0.5503 -0.5430 -0.5416 1.9965
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.84719 0.06917 -26.705 <2e-16 ***
## TroponinT_max 0.06537 0.02638 2.478 0.0132 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1694.1 on 2059 degrees of freedom
## AIC: 1698.1
##
## Number of Fisher Scoring iterations: 4
minUrine_glm <- glm(in_hospital_death ~ Urine_min, data=icu_patients_df1, family="binomial")
summary(minUrine_glm) # is significant
##
## Call:
## glm(formula = in_hospital_death ~ Urine_min, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.6034 -0.5952 -0.5631 -0.5105 2.9438
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.610937 0.076052 -21.182 < 2e-16 ***
## Urine_min -0.006020 0.001787 -3.369 0.000756 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1683.1 on 2059 degrees of freedom
## AIC: 1687.1
##
## Number of Fisher Scoring iterations: 5
minWBC_glm <- glm(in_hospital_death ~ WBC_min, data=icu_patients_df1, family="binomial")
summary(minWBC_glm) # is significant
##
## Call:
## glm(formula = in_hospital_death ~ WBC_min, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.2861 -0.5638 -0.5477 -0.5315 2.0563
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.987167 0.119356 -16.649 <2e-16 ***
## WBC_min 0.017452 0.008437 2.068 0.0386 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1695.6 on 2059 degrees of freedom
## AIC: 1699.6
##
## Number of Fisher Scoring iterations: 4
maxWBC_glm <- glm(in_hospital_death ~ WBC_max, data=icu_patients_df1, family="binomial")
summary(maxWBC_glm) # is significant
##
## Call:
## glm(formula = in_hospital_death ~ WBC_max, family = "binomial",
## data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.2674 -0.5631 -0.5475 -0.5326 2.0545
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.982652 0.118080 -16.791 <2e-16 ***
## WBC_max 0.014086 0.006859 2.054 0.04 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1699.7 on 2060 degrees of freedom
## Residual deviance: 1695.7 on 2059 degrees of freedom
## AIC: 1699.7
##
## Number of Fisher Scoring iterations: 4
### IN SUMMARY:
# significant variables were:
# age
# ICUType
# Weight_max
# Albumin_min
# Bilirubin_max
# BUN_max
# Creatinine_max
# GCS_min
# Glucose_max
# HCO3_min
# HR_max
# Lactate_max
# Na_min
# NISysABP_min
# pH_min
# RespRate_min
# RespRate_max
# Temp_min
# TroponinT_max
# Urine_min
# WBC_min
# WBC_max
# non-significant variables were:
# Glucose_min
# HR_min
# K_min
# K_max
# MAP_min
# Na_max
# NISysABP_max
# Platelets_min
# PFratio
# pH_max
# Temp_max
# TroponinI_max
#################################################################################
### CODE COPIED FROM TASK 2
## Create a dataset without missing or invalid data to use to build the model ##
## in order to remain consistent and allow comparisons between models to be made ##
# Check counts of missing data in each variable
for(i in 1:length(colnames(icu_patients_df1))){
print(c(i,colnames(icu_patients_df1[i]), sum(is.na(icu_patients_df1[i]))))
}
## [1] "1" "RecordID" "0"
## [1] "2" "Length_of_stay" "0"
## [1] "3" "SAPS1" "96"
## [1] "4" "SOFA" "0"
## [1] "5" "Survival" "1288"
## [1] "6" "in_hospital_death" "0"
## [1] "7" "Days" "0"
## [1] "8" "Status" "0"
## [1] "9" "Age" "0"
## [1] "10" "Albumin_diff" "0"
## [1] "11" "Albumin_max" "0"
## [1] "12" "Albumin_min" "0"
## [1] "13" "ALP_diff" "0"
## [1] "14" "ALP_max" "0"
## [1] "15" "ALP_min" "0"
## [1] "16" "ALT_diff" "0"
## [1] "17" "ALT_max" "0"
## [1] "18" "ALT_min" "0"
## [1] "19" "AST_diff" "0"
## [1] "20" "AST_max" "0"
## [1] "21" "AST_min" "0"
## [1] "22" "Bilirubin_diff" "0"
## [1] "23" "Bilirubin_max" "0"
## [1] "24" "Bilirubin_min" "0"
## [1] "25" "BUN_diff" "0"
## [1] "26" "BUN_max" "0"
## [1] "27" "BUN_min" "0"
## [1] "28" "Cholesterol_diff" "0"
## [1] "29" "Cholesterol_max" "0"
## [1] "30" "Cholesterol_min" "0"
## [1] "31" "Creatinine_diff" "0"
## [1] "32" "Creatinine_max" "0"
## [1] "33" "Creatinine_min" "0"
## [1] "34" "DiasABP_diff" "715"
## [1] "35" "DiasABP_max" "715"
## [1] "36" "DiasABP_min" "715"
## [1] "37" "FiO2_diff" "0"
## [1] "38" "FiO2_max" "0"
## [1] "39" "FiO2_min" "0"
## [1] "40" "GCS_diff" "0"
## [1] "41" "GCS_max" "0"
## [1] "42" "GCS_min" "0"
## [1] "43" "Gender" "0"
## [1] "44" "Glucose_diff" "0"
## [1] "45" "Glucose_max" "0"
## [1] "46" "Glucose_min" "0"
## [1] "47" "HCO3_diff" "0"
## [1] "48" "HCO3_max" "0"
## [1] "49" "HCO3_min" "0"
## [1] "50" "HCT_diff" "0"
## [1] "51" "HCT_max" "0"
## [1] "52" "HCT_min" "0"
## [1] "53" "Height" "992"
## [1] "54" "HR_diff" "0"
## [1] "55" "HR_max" "0"
## [1] "56" "HR_min" "0"
## [1] "57" "ICUType" "0"
## [1] "58" "K_diff" "0"
## [1] "59" "K_max" "0"
## [1] "60" "K_min" "0"
## [1] "61" "Lactate_diff" "0"
## [1] "62" "Lactate_max" "0"
## [1] "63" "Lactate_min" "0"
## [1] "64" "MAP_diff" "0"
## [1] "65" "MAP_max" "0"
## [1] "66" "MAP_min" "0"
## [1] "67" "Mg_diff" "0"
## [1] "68" "Mg_max" "0"
## [1] "69" "Mg_min" "0"
## [1] "70" "Na_diff" "0"
## [1] "71" "Na_max" "0"
## [1] "72" "Na_min" "0"
## [1] "73" "NIDiasABP_diff" "455"
## [1] "74" "NIDiasABP_max" "455"
## [1] "75" "NIDiasABP_min" "455"
## [1] "76" "NIMAP_diff" "455"
## [1] "77" "NIMAP_max" "455"
## [1] "78" "NIMAP_min" "455"
## [1] "79" "NISysABP_diff" "453"
## [1] "80" "NISysABP_max" "453"
## [1] "81" "NISysABP_min" "453"
## [1] "82" "PaCO2_diff" "0"
## [1] "83" "PaCO2_max" "0"
## [1] "84" "PaCO2_min" "0"
## [1] "85" "PaO2_diff" "0"
## [1] "86" "PaO2_max" "0"
## [1] "87" "PaO2_min" "0"
## [1] "88" "pH_diff" "0"
## [1] "89" "pH_max" "0"
## [1] "90" "pH_min" "0"
## [1] "91" "Platelets_diff" "0"
## [1] "92" "Platelets_max" "0"
## [1] "93" "Platelets_min" "0"
## [1] "94" "RespRate_diff" "0"
## [1] "95" "RespRate_max" "0"
## [1] "96" "RespRate_min" "0"
## [1] "97" "SaO2_diff" "0"
## [1] "98" "SaO2_max" "0"
## [1] "99" "SaO2_min" "0"
## [1] "100" "SysABP_diff" "715"
## [1] "101" "SysABP_max" "715"
## [1] "102" "SysABP_min" "715"
## [1] "103" "Temp_diff" "0"
## [1] "104" "Temp_max" "0"
## [1] "105" "Temp_min" "0"
## [1] "106" "TroponinI_diff" "0"
## [1] "107" "TroponinI_max" "0"
## [1] "108" "TroponinI_min" "0"
## [1] "109" "TroponinT_diff" "0"
## [1] "110" "TroponinT_max" "0"
## [1] "111" "TroponinT_min" "0"
## [1] "112" "Urine_diff" "0"
## [1] "113" "Urine_max" "0"
## [1] "114" "Urine_min" "0"
## [1] "115" "WBC_diff" "0"
## [1] "116" "WBC_max" "0"
## [1] "117" "WBC_min" "0"
## [1] "118" "Weight_diff" "146"
## [1] "119" "Weight_max" "146"
## [1] "120" "Weight_min" "146"
## [1] "121" "PFratio" "0"
## Result: of the variables chosen to explore for the survival model, large amounts of missing data in:
## Height (992), NISysABP_min (453), NISysABP_max (453), Weight_max (146)
## Decision: include Weight_max; remove Height, NISysABP_min, NISysABP_max
# Check counts of negative data (noted some -1 values) in each variable
for(i in 1:length(colnames(icu_patients_df1))){
print(c(i,colnames(icu_patients_df1[i]), sum(icu_patients_df1[i] < 0)))
}
## [1] "1" "RecordID" "0"
## [1] "2" "Length_of_stay" "25"
## [1] "3" "SAPS1" NA
## [1] "4" "SOFA" "65"
## [1] "5" "Survival" NA
## [1] "6" "in_hospital_death" "0"
## [1] "7" "Days" "0"
## [1] "8" "Status" "0"
## [1] "9" "Age" "0"
## [1] "10" "Albumin_diff" "0"
## [1] "11" "Albumin_max" "0"
## [1] "12" "Albumin_min" "0"
## [1] "13" "ALP_diff" "0"
## [1] "14" "ALP_max" "0"
## [1] "15" "ALP_min" "0"
## [1] "16" "ALT_diff" "0"
## [1] "17" "ALT_max" "0"
## [1] "18" "ALT_min" "0"
## [1] "19" "AST_diff" "0"
## [1] "20" "AST_max" "0"
## [1] "21" "AST_min" "0"
## [1] "22" "Bilirubin_diff" "0"
## [1] "23" "Bilirubin_max" "0"
## [1] "24" "Bilirubin_min" "0"
## [1] "25" "BUN_diff" "0"
## [1] "26" "BUN_max" "0"
## [1] "27" "BUN_min" "0"
## [1] "28" "Cholesterol_diff" "0"
## [1] "29" "Cholesterol_max" "0"
## [1] "30" "Cholesterol_min" "0"
## [1] "31" "Creatinine_diff" "0"
## [1] "32" "Creatinine_max" "0"
## [1] "33" "Creatinine_min" "0"
## [1] "34" "DiasABP_diff" NA
## [1] "35" "DiasABP_max" NA
## [1] "36" "DiasABP_min" NA
## [1] "37" "FiO2_diff" "0"
## [1] "38" "FiO2_max" "0"
## [1] "39" "FiO2_min" "0"
## [1] "40" "GCS_diff" "0"
## [1] "41" "GCS_max" "0"
## [1] "42" "GCS_min" "0"
## Warning in Ops.factor(left, right): '<' not meaningful for factors
## [1] "43" "Gender" NA
## [1] "44" "Glucose_diff" "0"
## [1] "45" "Glucose_max" "0"
## [1] "46" "Glucose_min" "0"
## [1] "47" "HCO3_diff" "0"
## [1] "48" "HCO3_max" "0"
## [1] "49" "HCO3_min" "0"
## [1] "50" "HCT_diff" "0"
## [1] "51" "HCT_max" "0"
## [1] "52" "HCT_min" "0"
## [1] "53" "Height" NA
## [1] "54" "HR_diff" "0"
## [1] "55" "HR_max" "0"
## [1] "56" "HR_min" "0"
## Warning in Ops.factor(left, right): '<' not meaningful for factors
## [1] "57" "ICUType" NA
## [1] "58" "K_diff" "0"
## [1] "59" "K_max" "0"
## [1] "60" "K_min" "0"
## [1] "61" "Lactate_diff" "0"
## [1] "62" "Lactate_max" "0"
## [1] "63" "Lactate_min" "0"
## [1] "64" "MAP_diff" "0"
## [1] "65" "MAP_max" "0"
## [1] "66" "MAP_min" "0"
## [1] "67" "Mg_diff" "0"
## [1] "68" "Mg_max" "0"
## [1] "69" "Mg_min" "0"
## [1] "70" "Na_diff" "0"
## [1] "71" "Na_max" "0"
## [1] "72" "Na_min" "0"
## [1] "73" "NIDiasABP_diff" NA
## [1] "74" "NIDiasABP_max" NA
## [1] "75" "NIDiasABP_min" NA
## [1] "76" "NIMAP_diff" NA
## [1] "77" "NIMAP_max" NA
## [1] "78" "NIMAP_min" NA
## [1] "79" "NISysABP_diff" NA
## [1] "80" "NISysABP_max" NA
## [1] "81" "NISysABP_min" NA
## [1] "82" "PaCO2_diff" "0"
## [1] "83" "PaCO2_max" "0"
## [1] "84" "PaCO2_min" "0"
## [1] "85" "PaO2_diff" "0"
## [1] "86" "PaO2_max" "0"
## [1] "87" "PaO2_min" "0"
## [1] "88" "pH_diff" "0"
## [1] "89" "pH_max" "0"
## [1] "90" "pH_min" "0"
## [1] "91" "Platelets_diff" "0"
## [1] "92" "Platelets_max" "0"
## [1] "93" "Platelets_min" "0"
## [1] "94" "RespRate_diff" "0"
## [1] "95" "RespRate_max" "0"
## [1] "96" "RespRate_min" "0"
## [1] "97" "SaO2_diff" "0"
## [1] "98" "SaO2_max" "0"
## [1] "99" "SaO2_min" "0"
## [1] "100" "SysABP_diff" NA
## [1] "101" "SysABP_max" NA
## [1] "102" "SysABP_min" NA
## [1] "103" "Temp_diff" "0"
## [1] "104" "Temp_max" "0"
## [1] "105" "Temp_min" "0"
## [1] "106" "TroponinI_diff" "0"
## [1] "107" "TroponinI_max" "0"
## [1] "108" "TroponinI_min" "0"
## [1] "109" "TroponinT_diff" "0"
## [1] "110" "TroponinT_max" "0"
## [1] "111" "TroponinT_min" "0"
## [1] "112" "Urine_diff" "0"
## [1] "113" "Urine_max" "0"
## [1] "114" "Urine_min" "0"
## [1] "115" "WBC_diff" "0"
## [1] "116" "WBC_max" "0"
## [1] "117" "WBC_min" "0"
## [1] "118" "Weight_diff" NA
## [1] "119" "Weight_max" NA
## [1] "120" "Weight_min" NA
## [1] "121" "PFratio" "0"
## Result: negative values in Length_of_stay and SOFA (not listed in initial choice of variables anyway)
# Create a new dataset with the only non-missing data from list of initial variables chosen
# (excluding those with very high missingness i.e. Height, NISysABP_min, NISysABP_max)
nm_icu_model_df1 <- na.omit(subset(icu_patients_df1,
select=c(Days, Status, # the survival object variables
RecordID, # keep record id for reference if needed
in_hospital_death, # for task 1
Age, Gender, ICUType, Weight_max,
Albumin_min, Bilirubin_max,
BUN_max, Creatinine_max,
GCS_max, Glucose_min, Glucose_max,
HCO3_min, HR_min, HR_max, K_min,
K_max, Lactate_max, MAP_min, Na_min,
Na_max, Platelets_min, PFratio, pH_min,
pH_max, RespRate_min, RespRate_max,
Temp_min, Temp_max, TroponinT_max,
TroponinI_max, Urine_min, WBC_min, WBC_max)))
### CODE COPIED FROM TASK 2
#################################################################################
# all variables from initially selected predictors
full_glm <- glm(in_hospital_death ~
Age +
Gender +
ICUType +
Weight_max +
Albumin_min +
Bilirubin_max +
BUN_max +
Creatinine_max +
GCS_max +
Glucose_min +
Glucose_max +
HCO3_min +
HR_min +
HR_max +
K_min +
K_max +
Lactate_max +
MAP_min +
Na_min +
Na_max +
Platelets_min +
PFratio +
pH_min +
pH_max +
RespRate_min +
RespRate_max +
Temp_min +
Temp_max +
TroponinT_max +
TroponinI_max +
Urine_min +
WBC_min +
WBC_max
,data=nm_icu_model_df1, family="binomial")
summary(full_glm) #AIC 1332.1
##
## Call:
## glm(formula = in_hospital_death ~ Age + Gender + ICUType + Weight_max +
## Albumin_min + Bilirubin_max + BUN_max + Creatinine_max +
## GCS_max + Glucose_min + Glucose_max + HCO3_min + HR_min +
## HR_max + K_min + K_max + Lactate_max + MAP_min + Na_min +
## Na_max + Platelets_min + PFratio + pH_min + pH_max + RespRate_min +
## RespRate_max + Temp_min + Temp_max + TroponinT_max + TroponinI_max +
## Urine_min + WBC_min + WBC_max, family = "binomial", data = nm_icu_model_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.0025 -0.5414 -0.3387 -0.1826 3.1551
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 24.7550693 11.0324370 2.244 0.024842 *
## Age 0.0355727 0.0055679 6.389 1.67e-10 ***
## GenderMale -0.0005774 0.1586626 -0.004 0.997097
## ICUTypeCardiac Surgery Recovery Unit -1.1946684 0.3314631 -3.604 0.000313 ***
## ICUTypeMedical ICU 0.1457551 0.2305142 0.632 0.527188
## ICUTypeSurgical ICU 0.1776610 0.2563794 0.693 0.488334
## Weight_max -0.0041882 0.0037136 -1.128 0.259409
## Albumin_min -0.3103087 0.1269198 -2.445 0.014488 *
## Bilirubin_max 0.0397973 0.0145689 2.732 0.006301 **
## BUN_max 0.0218067 0.0041617 5.240 1.61e-07 ***
## Creatinine_max -0.0512660 0.0566167 -0.905 0.365204
## GCS_max -0.1896782 0.0267396 -7.094 1.31e-12 ***
## Glucose_min 0.0004277 0.0017341 0.247 0.805197
## Glucose_max 0.0005729 0.0010105 0.567 0.570710
## HCO3_min 0.0094985 0.0185570 0.512 0.608753
## HR_min 0.0110264 0.0057790 1.908 0.056391 .
## HR_max 0.0046164 0.0038442 1.201 0.229792
## K_min -0.0801749 0.1621385 -0.494 0.620964
## K_max -0.0707587 0.1016629 -0.696 0.486420
## Lactate_max 0.0645205 0.0365291 1.766 0.077350 .
## MAP_min -0.0001513 0.0044240 -0.034 0.972727
## Na_min 0.0041071 0.0353159 0.116 0.907418
## Na_max -0.0648695 0.0356990 -1.817 0.069198 .
## Platelets_min -0.0009868 0.0008076 -1.222 0.221726
## PFratio -0.0001635 0.0007894 -0.207 0.835900
## pH_min -1.2268398 0.9477985 -1.294 0.195524
## pH_max -0.1918512 1.4140768 -0.136 0.892080
## RespRate_min -0.0231207 0.0254338 -0.909 0.363322
## RespRate_max 0.0138618 0.0122981 1.127 0.259680
## Temp_min -0.1907196 0.0883748 -2.158 0.030922 *
## Temp_max -0.0308143 0.1062282 -0.290 0.771758
## TroponinT_max 0.0188442 0.0354984 0.531 0.595525
## TroponinI_max -0.0028271 0.0078796 -0.359 0.719758
## Urine_min -0.0063152 0.0026190 -2.411 0.015897 *
## WBC_min 0.0656428 0.0277205 2.368 0.017883 *
## WBC_max -0.0521569 0.0229737 -2.270 0.023190 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1604.2 on 1914 degrees of freedom
## Residual deviance: 1260.1 on 1879 degrees of freedom
## AIC: 1332.1
##
## Number of Fisher Scoring iterations: 6
###
# variables that were significant on univariate comparisons
signifUni_glm <- glm(in_hospital_death ~
Age +
ICUType +
Weight_max +
Albumin_min +
Bilirubin_max +
BUN_max +
Creatinine_max +
GCS_max +
Glucose_max +
HCO3_min +
HR_max +
Lactate_max +
Na_min +
# NISysABP_min + this was removed from the na.omit part anyway
pH_min +
RespRate_min +
RespRate_max +
Temp_min +
TroponinT_max +
Urine_min +
WBC_min +
WBC_max
,data=nm_icu_model_df1, family="binomial")
summary(signifUni_glm) #AIC 1320.9
##
## Call:
## glm(formula = in_hospital_death ~ Age + ICUType + Weight_max +
## Albumin_min + Bilirubin_max + BUN_max + Creatinine_max +
## GCS_max + Glucose_max + HCO3_min + HR_max + Lactate_max +
## Na_min + pH_min + RespRate_min + RespRate_max + Temp_min +
## TroponinT_max + Urine_min + WBC_min + WBC_max, family = "binomial",
## data = nm_icu_model_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.9897 -0.5398 -0.3458 -0.1906 3.0306
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.799e+01 6.567e+00 2.739 0.006157 **
## Age 3.404e-02 5.318e-03 6.401 1.55e-10 ***
## ICUTypeCardiac Surgery Recovery Unit -1.087e+00 3.073e-01 -3.538 0.000403 ***
## ICUTypeMedical ICU 1.537e-01 2.259e-01 0.680 0.496226
## ICUTypeSurgical ICU 1.585e-01 2.470e-01 0.642 0.521184
## Weight_max -3.417e-03 3.473e-03 -0.984 0.325245
## Albumin_min -3.454e-01 1.223e-01 -2.824 0.004737 **
## Bilirubin_max 4.376e-02 1.403e-02 3.120 0.001811 **
## BUN_max 2.101e-02 3.916e-03 5.365 8.10e-08 ***
## Creatinine_max -6.020e-02 5.508e-02 -1.093 0.274450
## GCS_max -1.781e-01 2.490e-02 -7.155 8.39e-13 ***
## Glucose_max -6.786e-07 7.610e-04 -0.001 0.999288
## HCO3_min 6.078e-03 1.765e-02 0.344 0.730494
## HR_max 7.162e-03 3.308e-03 2.165 0.030393 *
## Lactate_max 6.304e-02 3.494e-02 1.804 0.071235 .
## Na_min -4.359e-02 1.467e-02 -2.972 0.002959 **
## pH_min -1.172e+00 8.056e-01 -1.455 0.145582
## RespRate_min -1.761e-02 2.465e-02 -0.715 0.474870
## RespRate_max 1.419e-02 1.103e-02 1.287 0.198258
## Temp_min -1.578e-01 7.993e-02 -1.974 0.048379 *
## TroponinT_max 1.198e-02 3.453e-02 0.347 0.728694
## Urine_min -6.348e-03 2.574e-03 -2.467 0.013643 *
## WBC_min 6.828e-02 2.601e-02 2.625 0.008672 **
## WBC_max -6.037e-02 2.207e-02 -2.736 0.006225 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1604.2 on 1914 degrees of freedom
## Residual deviance: 1272.9 on 1891 degrees of freedom
## AIC: 1320.9
##
## Number of Fisher Scoring iterations: 6
###
# variables that were significant in the full_glm
signifFull_glm <- glm(in_hospital_death ~
Age +
ICUType +
Albumin_min +
Bilirubin_max +
BUN_max +
GCS_max +
Temp_min +
Urine_min +
WBC_min +
WBC_max
,data=nm_icu_model_df1, family="binomial")
summary(signifFull_glm) #AIC 1330.2
##
## Call:
## glm(formula = in_hospital_death ~ Age + ICUType + Albumin_min +
## Bilirubin_max + BUN_max + GCS_max + Temp_min + Urine_min +
## WBC_min + WBC_max, family = "binomial", data = nm_icu_model_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.8919 -0.5497 -0.3649 -0.2046 3.0349
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 6.356911 2.698679 2.356 0.01849 *
## Age 0.030984 0.004850 6.389 1.67e-10 ***
## ICUTypeCardiac Surgery Recovery Unit -1.206231 0.286775 -4.206 2.60e-05 ***
## ICUTypeMedical ICU 0.065555 0.210415 0.312 0.75538
## ICUTypeSurgical ICU -0.033654 0.229228 -0.147 0.88328
## Albumin_min -0.380485 0.118054 -3.223 0.00127 **
## Bilirubin_max 0.054089 0.013137 4.117 3.83e-05 ***
## BUN_max 0.017585 0.002832 6.209 5.34e-10 ***
## GCS_max -0.179975 0.020954 -8.589 < 2e-16 ***
## Temp_min -0.201811 0.073755 -2.736 0.00621 **
## Urine_min -0.007162 0.002585 -2.770 0.00560 **
## WBC_min 0.055865 0.024568 2.274 0.02297 *
## WBC_max -0.044776 0.020492 -2.185 0.02889 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1604.2 on 1914 degrees of freedom
## Residual deviance: 1304.2 on 1902 degrees of freedom
## AIC: 1330.2
##
## Number of Fisher Scoring iterations: 6
# no missing data removed due to missingness
# anova doesn't work because different missing data between the models
anova(full_glm, signifUni_glm, test="Chisq") # the parameters different between the models are not significant
## Analysis of Deviance Table
##
## Model 1: in_hospital_death ~ Age + Gender + ICUType + Weight_max + Albumin_min +
## Bilirubin_max + BUN_max + Creatinine_max + GCS_max + Glucose_min +
## Glucose_max + HCO3_min + HR_min + HR_max + K_min + K_max +
## Lactate_max + MAP_min + Na_min + Na_max + Platelets_min +
## PFratio + pH_min + pH_max + RespRate_min + RespRate_max +
## Temp_min + Temp_max + TroponinT_max + TroponinI_max + Urine_min +
## WBC_min + WBC_max
## Model 2: in_hospital_death ~ Age + ICUType + Weight_max + Albumin_min +
## Bilirubin_max + BUN_max + Creatinine_max + GCS_max + Glucose_max +
## HCO3_min + HR_max + Lactate_max + Na_min + pH_min + RespRate_min +
## RespRate_max + Temp_min + TroponinT_max + Urine_min + WBC_min +
## WBC_max
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 1879 1260.1
## 2 1891 1272.9 -12 -12.783 0.385
anova(full_glm, signifFull_glm, test="Chisq") # the dropped parameters between the two models do matter
## Analysis of Deviance Table
##
## Model 1: in_hospital_death ~ Age + Gender + ICUType + Weight_max + Albumin_min +
## Bilirubin_max + BUN_max + Creatinine_max + GCS_max + Glucose_min +
## Glucose_max + HCO3_min + HR_min + HR_max + K_min + K_max +
## Lactate_max + MAP_min + Na_min + Na_max + Platelets_min +
## PFratio + pH_min + pH_max + RespRate_min + RespRate_max +
## Temp_min + Temp_max + TroponinT_max + TroponinI_max + Urine_min +
## WBC_min + WBC_max
## Model 2: in_hospital_death ~ Age + ICUType + Albumin_min + Bilirubin_max +
## BUN_max + GCS_max + Temp_min + Urine_min + WBC_min + WBC_max
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 1879 1260.1
## 2 1902 1304.2 -23 -44.154 0.005039 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
###
# using the model with the lowest AIC
# reduce it even further
reduced_signifUni_glm <- step(signifUni_glm, trace=1)
## Start: AIC=1320.87
## in_hospital_death ~ Age + ICUType + Weight_max + Albumin_min +
## Bilirubin_max + BUN_max + Creatinine_max + GCS_max + Glucose_max +
## HCO3_min + HR_max + Lactate_max + Na_min + pH_min + RespRate_min +
## RespRate_max + Temp_min + TroponinT_max + Urine_min + WBC_min +
## WBC_max
##
## Df Deviance AIC
## - Glucose_max 1 1272.9 1318.9
## - HCO3_min 1 1273.0 1319.0
## - TroponinT_max 1 1273.0 1319.0
## - RespRate_min 1 1273.4 1319.4
## - Weight_max 1 1273.9 1319.9
## - Creatinine_max 1 1274.1 1320.1
## - RespRate_max 1 1274.5 1320.5
## <none> 1272.9 1320.9
## - Lactate_max 1 1276.1 1322.1
## - pH_min 1 1276.6 1322.6
## - Temp_min 1 1276.9 1322.9
## - HR_max 1 1277.5 1323.5
## - WBC_min 1 1280.1 1326.1
## - Urine_min 1 1280.9 1326.9
## - WBC_max 1 1280.9 1326.9
## - Albumin_min 1 1280.9 1326.9
## - Na_min 1 1281.6 1327.6
## - Bilirubin_max 1 1282.3 1328.3
## - ICUType 3 1302.5 1344.5
## - BUN_max 1 1302.5 1348.5
## - Age 1 1318.7 1364.7
## - GCS_max 1 1325.1 1371.1
##
## Step: AIC=1318.87
## in_hospital_death ~ Age + ICUType + Weight_max + Albumin_min +
## Bilirubin_max + BUN_max + Creatinine_max + GCS_max + HCO3_min +
## HR_max + Lactate_max + Na_min + pH_min + RespRate_min + RespRate_max +
## Temp_min + TroponinT_max + Urine_min + WBC_min + WBC_max
##
## Df Deviance AIC
## - TroponinT_max 1 1273.0 1317.0
## - HCO3_min 1 1273.0 1317.0
## - RespRate_min 1 1273.4 1317.4
## - Weight_max 1 1273.9 1317.9
## - Creatinine_max 1 1274.1 1318.1
## - RespRate_max 1 1274.5 1318.5
## <none> 1272.9 1318.9
## - Lactate_max 1 1276.2 1320.2
## - pH_min 1 1276.6 1320.6
## - Temp_min 1 1276.9 1320.9
## - HR_max 1 1277.5 1321.5
## - WBC_min 1 1280.1 1324.1
## - Urine_min 1 1280.9 1324.9
## - WBC_max 1 1280.9 1324.9
## - Albumin_min 1 1281.0 1325.0
## - Na_min 1 1281.7 1325.7
## - Bilirubin_max 1 1282.4 1326.4
## - ICUType 3 1303.2 1343.2
## - BUN_max 1 1302.6 1346.6
## - Age 1 1318.8 1362.8
## - GCS_max 1 1325.3 1369.3
##
## Step: AIC=1316.99
## in_hospital_death ~ Age + ICUType + Weight_max + Albumin_min +
## Bilirubin_max + BUN_max + Creatinine_max + GCS_max + HCO3_min +
## HR_max + Lactate_max + Na_min + pH_min + RespRate_min + RespRate_max +
## Temp_min + Urine_min + WBC_min + WBC_max
##
## Df Deviance AIC
## - HCO3_min 1 1273.1 1315.1
## - RespRate_min 1 1273.5 1315.5
## - Weight_max 1 1274.0 1316.0
## - Creatinine_max 1 1274.2 1316.2
## - RespRate_max 1 1274.7 1316.7
## <none> 1273.0 1317.0
## - Lactate_max 1 1276.7 1318.7
## - Temp_min 1 1277.0 1319.0
## - pH_min 1 1277.1 1319.1
## - HR_max 1 1277.5 1319.5
## - WBC_min 1 1280.6 1322.6
## - Urine_min 1 1281.0 1323.0
## - Albumin_min 1 1281.2 1323.2
## - WBC_max 1 1281.4 1323.4
## - Na_min 1 1282.0 1324.0
## - Bilirubin_max 1 1282.9 1324.9
## - ICUType 3 1303.3 1341.3
## - BUN_max 1 1302.7 1344.7
## - Age 1 1318.8 1360.8
## - GCS_max 1 1325.5 1367.5
##
## Step: AIC=1315.11
## in_hospital_death ~ Age + ICUType + Weight_max + Albumin_min +
## Bilirubin_max + BUN_max + Creatinine_max + GCS_max + HR_max +
## Lactate_max + Na_min + pH_min + RespRate_min + RespRate_max +
## Temp_min + Urine_min + WBC_min + WBC_max
##
## Df Deviance AIC
## - RespRate_min 1 1273.6 1313.6
## - Weight_max 1 1274.1 1314.1
## - Creatinine_max 1 1274.4 1314.4
## - RespRate_max 1 1274.8 1314.8
## <none> 1273.1 1315.1
## - Lactate_max 1 1276.7 1316.7
## - Temp_min 1 1277.0 1317.0
## - pH_min 1 1277.1 1317.1
## - HR_max 1 1277.6 1317.6
## - WBC_min 1 1280.9 1320.9
## - Urine_min 1 1281.1 1321.1
## - Albumin_min 1 1281.2 1321.2
## - WBC_max 1 1281.9 1321.9
## - Na_min 1 1282.0 1322.0
## - Bilirubin_max 1 1283.2 1323.2
## - ICUType 3 1303.3 1339.3
## - BUN_max 1 1302.7 1342.7
## - Age 1 1319.3 1359.3
## - GCS_max 1 1325.5 1365.5
##
## Step: AIC=1313.62
## in_hospital_death ~ Age + ICUType + Weight_max + Albumin_min +
## Bilirubin_max + BUN_max + Creatinine_max + GCS_max + HR_max +
## Lactate_max + Na_min + pH_min + RespRate_max + Temp_min +
## Urine_min + WBC_min + WBC_max
##
## Df Deviance AIC
## - Weight_max 1 1274.6 1312.6
## - RespRate_max 1 1274.8 1312.8
## - Creatinine_max 1 1274.9 1312.9
## <none> 1273.6 1313.6
## - Lactate_max 1 1277.3 1315.3
## - pH_min 1 1277.4 1315.4
## - Temp_min 1 1277.7 1315.7
## - HR_max 1 1277.9 1315.9
## - Albumin_min 1 1281.5 1319.5
## - Urine_min 1 1281.6 1319.6
## - WBC_min 1 1281.8 1319.8
## - Na_min 1 1282.3 1320.3
## - WBC_max 1 1283.0 1321.0
## - Bilirubin_max 1 1284.3 1322.3
## - ICUType 3 1303.4 1337.4
## - BUN_max 1 1303.3 1341.3
## - Age 1 1319.3 1357.3
## - GCS_max 1 1329.8 1367.8
##
## Step: AIC=1312.62
## in_hospital_death ~ Age + ICUType + Albumin_min + Bilirubin_max +
## BUN_max + Creatinine_max + GCS_max + HR_max + Lactate_max +
## Na_min + pH_min + RespRate_max + Temp_min + Urine_min + WBC_min +
## WBC_max
##
## Df Deviance AIC
## - RespRate_max 1 1275.8 1311.8
## - Creatinine_max 1 1276.1 1312.1
## <none> 1274.6 1312.6
## - pH_min 1 1278.2 1314.2
## - Lactate_max 1 1278.3 1314.3
## - HR_max 1 1279.2 1315.2
## - Temp_min 1 1279.5 1315.5
## - Albumin_min 1 1282.3 1318.3
## - Urine_min 1 1282.7 1318.7
## - WBC_min 1 1282.8 1318.8
## - Na_min 1 1283.2 1319.2
## - WBC_max 1 1284.2 1320.2
## - Bilirubin_max 1 1285.2 1321.2
## - ICUType 3 1306.4 1338.4
## - BUN_max 1 1303.7 1339.7
## - Age 1 1326.6 1362.6
## - GCS_max 1 1330.3 1366.3
##
## Step: AIC=1311.85
## in_hospital_death ~ Age + ICUType + Albumin_min + Bilirubin_max +
## BUN_max + Creatinine_max + GCS_max + HR_max + Lactate_max +
## Na_min + pH_min + Temp_min + Urine_min + WBC_min + WBC_max
##
## Df Deviance AIC
## - Creatinine_max 1 1277.1 1311.1
## <none> 1275.8 1311.8
## - Lactate_max 1 1279.5 1313.5
## - pH_min 1 1279.6 1313.6
## - Temp_min 1 1280.3 1314.3
## - HR_max 1 1281.4 1315.4
## - Albumin_min 1 1283.1 1317.1
## - Na_min 1 1283.8 1317.8
## - Urine_min 1 1284.0 1318.0
## - WBC_min 1 1284.0 1318.0
## - WBC_max 1 1285.0 1319.0
## - Bilirubin_max 1 1288.6 1322.6
## - ICUType 3 1307.0 1337.0
## - BUN_max 1 1304.6 1338.6
## - Age 1 1327.0 1361.0
## - GCS_max 1 1342.9 1376.9
##
## Step: AIC=1311.11
## in_hospital_death ~ Age + ICUType + Albumin_min + Bilirubin_max +
## BUN_max + GCS_max + HR_max + Lactate_max + Na_min + pH_min +
## Temp_min + Urine_min + WBC_min + WBC_max
##
## Df Deviance AIC
## <none> 1277.1 1311.1
## - Lactate_max 1 1280.7 1312.7
## - pH_min 1 1280.8 1312.8
## - Temp_min 1 1281.5 1313.5
## - HR_max 1 1282.9 1314.9
## - Na_min 1 1284.5 1316.5
## - Urine_min 1 1284.7 1316.7
## - Albumin_min 1 1284.8 1316.8
## - WBC_min 1 1285.6 1317.6
## - WBC_max 1 1286.6 1318.6
## - Bilirubin_max 1 1289.6 1321.6
## - ICUType 3 1308.6 1336.6
## - BUN_max 1 1314.1 1346.1
## - Age 1 1333.1 1365.1
## - GCS_max 1 1344.1 1376.1
# removed variables were:
# Glucose_max
# TroponinT_max
# HCO3_min
# RespRate_min
# Weight_max
# RespRate_max
# Creatinine_max
summary(reduced_signifUni_glm) # AIC 1311.1
##
## Call:
## glm(formula = in_hospital_death ~ Age + ICUType + Albumin_min +
## Bilirubin_max + BUN_max + GCS_max + HR_max + Lactate_max +
## Na_min + pH_min + Temp_min + Urine_min + WBC_min + WBC_max,
## family = "binomial", data = nm_icu_model_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.9438 -0.5450 -0.3479 -0.1945 2.9904
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 16.771564 6.180202 2.714 0.00665 **
## Age 0.035748 0.005082 7.034 2.01e-12 ***
## ICUTypeCardiac Surgery Recovery Unit -1.107288 0.292041 -3.792 0.00015 ***
## ICUTypeMedical ICU 0.138003 0.215368 0.641 0.52167
## ICUTypeSurgical ICU 0.123606 0.235752 0.524 0.60007
## Albumin_min -0.330533 0.119828 -2.758 0.00581 **
## Bilirubin_max 0.048073 0.013358 3.599 0.00032 ***
## BUN_max 0.017653 0.002894 6.101 1.06e-09 ***
## GCS_max -0.177828 0.021643 -8.217 < 2e-16 ***
## HR_max 0.007771 0.003215 2.417 0.01564 *
## Lactate_max 0.062615 0.033026 1.896 0.05797 .
## Na_min -0.038723 0.014114 -2.744 0.00608 **
## pH_min -1.101299 0.756621 -1.456 0.14552
## Temp_min -0.162389 0.078329 -2.073 0.03816 *
## Urine_min -0.006031 0.002509 -2.404 0.01622 *
## WBC_min 0.072729 0.025587 2.842 0.00448 **
## WBC_max -0.063857 0.021592 -2.957 0.00310 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1604.2 on 1914 degrees of freedom
## Residual deviance: 1277.1 on 1898 degrees of freedom
## AIC: 1311.1
##
## Number of Fisher Scoring iterations: 6
anova(reduced_signifUni_glm,signifUni_glm, test="Chisq")
## Analysis of Deviance Table
##
## Model 1: in_hospital_death ~ Age + ICUType + Albumin_min + Bilirubin_max +
## BUN_max + GCS_max + HR_max + Lactate_max + Na_min + pH_min +
## Temp_min + Urine_min + WBC_min + WBC_max
## Model 2: in_hospital_death ~ Age + ICUType + Weight_max + Albumin_min +
## Bilirubin_max + BUN_max + Creatinine_max + GCS_max + Glucose_max +
## HCO3_min + HR_max + Lactate_max + Na_min + pH_min + RespRate_min +
## RespRate_max + Temp_min + TroponinT_max + Urine_min + WBC_min +
## WBC_max
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 1898 1277.1
## 2 1891 1272.9 7 4.2406 0.7517
# p value not significant, the dropped parameters are not significant
# same as model above: reduced_signifUni_glm
finalICU_glm <- glm(in_hospital_death ~
Age +
ICUType +
Albumin_min +
Bilirubin_max +
BUN_max +
GCS_max +
HR_max +
Lactate_max +
Na_min +
pH_min +
Temp_min +
Urine_min +
WBC_min +
WBC_max
,data=nm_icu_model_df1, family="binomial")
summary(finalICU_glm) # AIC 1311.1
##
## Call:
## glm(formula = in_hospital_death ~ Age + ICUType + Albumin_min +
## Bilirubin_max + BUN_max + GCS_max + HR_max + Lactate_max +
## Na_min + pH_min + Temp_min + Urine_min + WBC_min + WBC_max,
## family = "binomial", data = nm_icu_model_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.9438 -0.5450 -0.3479 -0.1945 2.9904
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 16.771564 6.180202 2.714 0.00665 **
## Age 0.035748 0.005082 7.034 2.01e-12 ***
## ICUTypeCardiac Surgery Recovery Unit -1.107288 0.292041 -3.792 0.00015 ***
## ICUTypeMedical ICU 0.138003 0.215368 0.641 0.52167
## ICUTypeSurgical ICU 0.123606 0.235752 0.524 0.60007
## Albumin_min -0.330533 0.119828 -2.758 0.00581 **
## Bilirubin_max 0.048073 0.013358 3.599 0.00032 ***
## BUN_max 0.017653 0.002894 6.101 1.06e-09 ***
## GCS_max -0.177828 0.021643 -8.217 < 2e-16 ***
## HR_max 0.007771 0.003215 2.417 0.01564 *
## Lactate_max 0.062615 0.033026 1.896 0.05797 .
## Na_min -0.038723 0.014114 -2.744 0.00608 **
## pH_min -1.101299 0.756621 -1.456 0.14552
## Temp_min -0.162389 0.078329 -2.073 0.03816 *
## Urine_min -0.006031 0.002509 -2.404 0.01622 *
## WBC_min 0.072729 0.025587 2.842 0.00448 **
## WBC_max -0.063857 0.021592 -2.957 0.00310 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1604.2 on 1914 degrees of freedom
## Residual deviance: 1277.1 on 1898 degrees of freedom
## AIC: 1311.1
##
## Number of Fisher Scoring iterations: 6
### testing interactions
# finalICU_glm_AgeCr = finalICU_glm + Age:Creatinine_max
finalICU_glm_AgeCr <- glm(in_hospital_death ~
Age +
ICUType +
Albumin_min +
Bilirubin_max +
BUN_max +
GCS_max +
HR_max +
Lactate_max +
Na_min +
pH_min +
Temp_min +
Urine_min +
WBC_min +
WBC_max +
# interaction term
Age:Creatinine_max # creatinine generally increases with age
, data=nm_icu_model_df1, family="binomial")
summary(finalICU_glm_AgeCr) # AIC 1311.6
##
## Call:
## glm(formula = in_hospital_death ~ Age + ICUType + Albumin_min +
## Bilirubin_max + BUN_max + GCS_max + HR_max + Lactate_max +
## Na_min + pH_min + Temp_min + Urine_min + WBC_min + WBC_max +
## Age:Creatinine_max, family = "binomial", data = nm_icu_model_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.0058 -0.5441 -0.3471 -0.1923 3.0126
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 17.2042718 6.2610209 2.748 0.005999 **
## Age 0.0364778 0.0051215 7.123 1.06e-12 ***
## ICUTypeCardiac Surgery Recovery Unit -1.1050590 0.2924687 -3.778 0.000158 ***
## ICUTypeMedical ICU 0.1432747 0.2157226 0.664 0.506587
## ICUTypeSurgical ICU 0.1270050 0.2361028 0.538 0.590631
## Albumin_min -0.3200195 0.1202310 -2.662 0.007775 **
## Bilirubin_max 0.0482335 0.0133563 3.611 0.000305 ***
## BUN_max 0.0207435 0.0038808 5.345 9.04e-08 ***
## GCS_max -0.1779749 0.0216652 -8.215 < 2e-16 ***
## HR_max 0.0075795 0.0032185 2.355 0.018524 *
## Lactate_max 0.0634961 0.0330932 1.919 0.055022 .
## Na_min -0.0404502 0.0141531 -2.858 0.004263 **
## pH_min -1.1307197 0.7701256 -1.468 0.142042
## Temp_min -0.1627020 0.0784203 -2.075 0.038010 *
## Urine_min -0.0064029 0.0025826 -2.479 0.013166 *
## WBC_min 0.0713769 0.0255692 2.792 0.005246 **
## WBC_max -0.0630659 0.0215458 -2.927 0.003422 **
## Age:Creatinine_max -0.0010441 0.0008793 -1.187 0.235047
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1604.2 on 1914 degrees of freedom
## Residual deviance: 1275.6 on 1897 degrees of freedom
## AIC: 1311.6
##
## Number of Fisher Scoring iterations: 6
# finalICU_glm_AgeTemp = finalICU_glm + Age:Temp_min
finalICU_glm_AgeTemp <- glm(in_hospital_death ~
Age +
ICUType +
Albumin_min +
Bilirubin_max +
BUN_max +
GCS_max +
HR_max +
Lactate_max +
Na_min +
pH_min +
Temp_min +
Urine_min +
WBC_min +
WBC_max +
# interaction term
Age:Temp_min # low temp more often associated with illness in the elderly e.g. cold sepsis
, data=nm_icu_model_df1, family="binomial")
summary(finalICU_glm_AgeTemp) # AIC 1313.1
##
## Call:
## glm(formula = in_hospital_death ~ Age + ICUType + Albumin_min +
## Bilirubin_max + BUN_max + GCS_max + HR_max + Lactate_max +
## Na_min + pH_min + Temp_min + Urine_min + WBC_min + WBC_max +
## Age:Temp_min, family = "binomial", data = nm_icu_model_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.9443 -0.5449 -0.3478 -0.1945 2.9890
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 16.295971 11.197145 1.455 0.145567
## Age 0.042771 0.137985 0.310 0.756586
## ICUTypeCardiac Surgery Recovery Unit -1.107832 0.292268 -3.790 0.000150 ***
## ICUTypeMedical ICU 0.137945 0.215393 0.640 0.521891
## ICUTypeSurgical ICU 0.123568 0.235776 0.524 0.600216
## Albumin_min -0.330377 0.119870 -2.756 0.005849 **
## Bilirubin_max 0.048084 0.013358 3.600 0.000319 ***
## BUN_max 0.017650 0.002894 6.098 1.07e-09 ***
## GCS_max -0.177900 0.021689 -8.202 2.36e-16 ***
## HR_max 0.007774 0.003216 2.418 0.015615 *
## Lactate_max 0.062704 0.033071 1.896 0.057949 .
## Na_min -0.038711 0.014117 -2.742 0.006103 **
## pH_min -1.101215 0.756691 -1.455 0.145585
## Temp_min -0.149186 0.270756 -0.551 0.581637
## Urine_min -0.006032 0.002509 -2.404 0.016222 *
## WBC_min 0.072782 0.025611 2.842 0.004486 **
## WBC_max -0.063901 0.021611 -2.957 0.003108 **
## Age:Temp_min -0.000196 0.003848 -0.051 0.959380
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1604.2 on 1914 degrees of freedom
## Residual deviance: 1277.1 on 1897 degrees of freedom
## AIC: 1313.1
##
## Number of Fisher Scoring iterations: 6
# finalICU_glm_AgeWeight = finalICU_glm + Age:Weight_max (rather than using Weight_min previously)
finalICU_glm_AgeWeight <- glm(in_hospital_death ~
Age +
ICUType +
Albumin_min +
Bilirubin_max +
BUN_max +
GCS_max +
HR_max +
Lactate_max +
Na_min +
pH_min +
Temp_min +
Urine_min +
WBC_min +
WBC_max +
# interaction term
Age:Weight_max # weight generally decreases with age
, data=nm_icu_model_df1, family="binomial")
summary(finalICU_glm_AgeWeight) # AIC 1311
##
## Call:
## glm(formula = in_hospital_death ~ Age + ICUType + Albumin_min +
## Bilirubin_max + BUN_max + GCS_max + HR_max + Lactate_max +
## Na_min + pH_min + Temp_min + Urine_min + WBC_min + WBC_max +
## Age:Weight_max, family = "binomial", data = nm_icu_model_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.0043 -0.5467 -0.3475 -0.1917 3.0545
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.710e+01 6.323e+00 2.704 0.006847 **
## Age 3.949e-02 5.739e-03 6.882 5.92e-12 ***
## ICUTypeCardiac Surgery Recovery Unit -1.068e+00 2.934e-01 -3.639 0.000273 ***
## ICUTypeMedical ICU 1.308e-01 2.157e-01 0.607 0.544177
## ICUTypeSurgical ICU 1.330e-01 2.361e-01 0.563 0.573176
## Albumin_min -3.363e-01 1.199e-01 -2.805 0.005039 **
## Bilirubin_max 4.833e-02 1.338e-02 3.612 0.000304 ***
## BUN_max 1.823e-02 2.924e-03 6.233 4.57e-10 ***
## GCS_max -1.790e-01 2.169e-02 -8.253 < 2e-16 ***
## HR_max 7.452e-03 3.230e-03 2.307 0.021042 *
## Lactate_max 6.444e-02 3.315e-02 1.944 0.051930 .
## Na_min -3.907e-02 1.409e-02 -2.772 0.005564 **
## pH_min -1.201e+00 7.874e-01 -1.525 0.127242
## Temp_min -1.458e-01 7.896e-02 -1.846 0.064889 .
## Urine_min -5.978e-03 2.507e-03 -2.384 0.017109 *
## WBC_min 7.239e-02 2.559e-02 2.829 0.004674 **
## WBC_max -6.299e-02 2.162e-02 -2.914 0.003568 **
## Age:Weight_max -7.005e-05 5.052e-05 -1.387 0.165553
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1604.2 on 1914 degrees of freedom
## Residual deviance: 1275.1 on 1897 degrees of freedom
## AIC: 1311.1
##
## Number of Fisher Scoring iterations: 6
# finalICU_glm_AgeAlbumin = finalICU_glm + Age:Albumin_min
finalICU_glm_AgeAlbumin <- glm(in_hospital_death ~
Age +
ICUType +
Albumin_min +
Bilirubin_max +
BUN_max +
GCS_max +
HR_max +
Lactate_max +
Na_min +
pH_min +
Temp_min +
Urine_min +
WBC_min +
WBC_max +
# interaction term
Age:Albumin_min # albumin generally decreases with age
, data=nm_icu_model_df1, family="binomial")
summary(finalICU_glm_AgeAlbumin) # AIC 1309
##
## Call:
## glm(formula = in_hospital_death ~ Age + ICUType + Albumin_min +
## Bilirubin_max + BUN_max + GCS_max + HR_max + Lactate_max +
## Na_min + pH_min + Temp_min + Urine_min + WBC_min + WBC_max +
## Age:Albumin_min, family = "binomial", data = nm_icu_model_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.9359 -0.5523 -0.3464 -0.1840 3.0218
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 19.347306 6.173815 3.134 0.001726 **
## Age -0.004992 0.021570 -0.231 0.816990
## ICUTypeCardiac Surgery Recovery Unit -1.101538 0.292134 -3.771 0.000163 ***
## ICUTypeMedical ICU 0.125775 0.215780 0.583 0.559971
## ICUTypeSurgical ICU 0.125709 0.235844 0.533 0.594021
## Albumin_min -1.355174 0.548435 -2.471 0.013474 *
## Bilirubin_max 0.048750 0.013410 3.635 0.000278 ***
## BUN_max 0.017767 0.002897 6.133 8.62e-10 ***
## GCS_max -0.177107 0.021686 -8.167 3.16e-16 ***
## HR_max 0.007565 0.003220 2.350 0.018782 *
## Lactate_max 0.062344 0.033194 1.878 0.060356 .
## Na_min -0.037919 0.014226 -2.666 0.007687 **
## pH_min -1.070276 0.727151 -1.472 0.141054
## Temp_min -0.164386 0.078641 -2.090 0.036588 *
## Urine_min -0.005912 0.002509 -2.356 0.018449 *
## WBC_min 0.074097 0.025585 2.896 0.003778 **
## WBC_max -0.063696 0.021561 -2.954 0.003135 **
## Age:Albumin_min 0.014583 0.007592 1.921 0.054741 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1604.2 on 1914 degrees of freedom
## Residual deviance: 1273.4 on 1897 degrees of freedom
## AIC: 1309.4
##
## Number of Fisher Scoring iterations: 6
# finalICU_glm_AgeICUType = finalICU_glm + Age:ICUType
finalICU_glm_AgeICUType <- glm(in_hospital_death ~
Age +
ICUType +
Albumin_min +
Bilirubin_max +
BUN_max +
GCS_max +
HR_max +
Lactate_max +
Na_min +
pH_min +
Temp_min +
Urine_min +
WBC_min +
WBC_max +
# interaction term
Age:ICUType # age is likely to be related to ICU type
# e.g. elderly more likely to have poor outcome
# after surgery requiring post-op ICU support
, data=nm_icu_model_df1, family="binomial")
summary(finalICU_glm_AgeICUType) # AIC 1307
##
## Call:
## glm(formula = in_hospital_death ~ Age + ICUType + Albumin_min +
## Bilirubin_max + BUN_max + GCS_max + HR_max + Lactate_max +
## Na_min + pH_min + Temp_min + Urine_min + WBC_min + WBC_max +
## Age:ICUType, family = "binomial", data = nm_icu_model_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.9579 -0.5488 -0.3415 -0.1920 3.1057
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 17.858479 6.317804 2.827 0.004703
## Age 0.028563 0.015297 1.867 0.061863
## ICUTypeCardiac Surgery Recovery Unit -0.137499 1.721588 -0.080 0.936343
## ICUTypeMedical ICU 0.199901 1.243496 0.161 0.872284
## ICUTypeSurgical ICU -2.152542 1.365680 -1.576 0.114987
## Albumin_min -0.327271 0.121006 -2.705 0.006839
## Bilirubin_max 0.047961 0.013482 3.557 0.000374
## BUN_max 0.018057 0.002897 6.232 4.6e-10
## GCS_max -0.179741 0.021736 -8.269 < 2e-16
## HR_max 0.008283 0.003228 2.566 0.010299
## Lactate_max 0.061953 0.033160 1.868 0.061719
## Na_min -0.039643 0.014137 -2.804 0.005043
## pH_min -1.121623 0.768555 -1.459 0.144457
## Temp_min -0.170873 0.079380 -2.153 0.031350
## Urine_min -0.006144 0.002517 -2.441 0.014655
## WBC_min 0.072986 0.025797 2.829 0.004666
## WBC_max -0.065673 0.021802 -3.012 0.002594
## Age:ICUTypeCardiac Surgery Recovery Unit -0.013777 0.023475 -0.587 0.557276
## Age:ICUTypeMedical ICU -0.001538 0.016578 -0.093 0.926097
## Age:ICUTypeSurgical ICU 0.031959 0.018202 1.756 0.079123
##
## (Intercept) **
## Age .
## ICUTypeCardiac Surgery Recovery Unit
## ICUTypeMedical ICU
## ICUTypeSurgical ICU
## Albumin_min **
## Bilirubin_max ***
## BUN_max ***
## GCS_max ***
## HR_max *
## Lactate_max .
## Na_min **
## pH_min
## Temp_min *
## Urine_min *
## WBC_min **
## WBC_max **
## Age:ICUTypeCardiac Surgery Recovery Unit
## Age:ICUTypeMedical ICU
## Age:ICUTypeSurgical ICU .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1604.2 on 1914 degrees of freedom
## Residual deviance: 1266.9 on 1895 degrees of freedom
## AIC: 1306.9
##
## Number of Fisher Scoring iterations: 6
# Code from previous attempt at task 1
# Gender:HCT, PaO2:RespRate not tested because they are not in the final model
# Anova testing for the new models
lapply(list(finalICU_glm_AgeCr, finalICU_glm_AgeTemp, finalICU_glm_AgeWeight,
finalICU_glm_AgeAlbumin, finalICU_glm_AgeICUType),
function(x) {print(anova(finalICU_glm, x, test="Chisq"))} )
## Analysis of Deviance Table
##
## Model 1: in_hospital_death ~ Age + ICUType + Albumin_min + Bilirubin_max +
## BUN_max + GCS_max + HR_max + Lactate_max + Na_min + pH_min +
## Temp_min + Urine_min + WBC_min + WBC_max
## Model 2: in_hospital_death ~ Age + ICUType + Albumin_min + Bilirubin_max +
## BUN_max + GCS_max + HR_max + Lactate_max + Na_min + pH_min +
## Temp_min + Urine_min + WBC_min + WBC_max + Age:Creatinine_max
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 1898 1277.1
## 2 1897 1275.6 1 1.4776 0.2242
## Analysis of Deviance Table
##
## Model 1: in_hospital_death ~ Age + ICUType + Albumin_min + Bilirubin_max +
## BUN_max + GCS_max + HR_max + Lactate_max + Na_min + pH_min +
## Temp_min + Urine_min + WBC_min + WBC_max
## Model 2: in_hospital_death ~ Age + ICUType + Albumin_min + Bilirubin_max +
## BUN_max + GCS_max + HR_max + Lactate_max + Na_min + pH_min +
## Temp_min + Urine_min + WBC_min + WBC_max + Age:Temp_min
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 1898 1277.1
## 2 1897 1277.1 1 0.0025966 0.9594
## Analysis of Deviance Table
##
## Model 1: in_hospital_death ~ Age + ICUType + Albumin_min + Bilirubin_max +
## BUN_max + GCS_max + HR_max + Lactate_max + Na_min + pH_min +
## Temp_min + Urine_min + WBC_min + WBC_max
## Model 2: in_hospital_death ~ Age + ICUType + Albumin_min + Bilirubin_max +
## BUN_max + GCS_max + HR_max + Lactate_max + Na_min + pH_min +
## Temp_min + Urine_min + WBC_min + WBC_max + Age:Weight_max
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 1898 1277.1
## 2 1897 1275.1 1 1.9802 0.1594
## Analysis of Deviance Table
##
## Model 1: in_hospital_death ~ Age + ICUType + Albumin_min + Bilirubin_max +
## BUN_max + GCS_max + HR_max + Lactate_max + Na_min + pH_min +
## Temp_min + Urine_min + WBC_min + WBC_max
## Model 2: in_hospital_death ~ Age + ICUType + Albumin_min + Bilirubin_max +
## BUN_max + GCS_max + HR_max + Lactate_max + Na_min + pH_min +
## Temp_min + Urine_min + WBC_min + WBC_max + Age:Albumin_min
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 1898 1277.1
## 2 1897 1273.4 1 3.6995 0.05443 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Analysis of Deviance Table
##
## Model 1: in_hospital_death ~ Age + ICUType + Albumin_min + Bilirubin_max +
## BUN_max + GCS_max + HR_max + Lactate_max + Na_min + pH_min +
## Temp_min + Urine_min + WBC_min + WBC_max
## Model 2: in_hospital_death ~ Age + ICUType + Albumin_min + Bilirubin_max +
## BUN_max + GCS_max + HR_max + Lactate_max + Na_min + pH_min +
## Temp_min + Urine_min + WBC_min + WBC_max + Age:ICUType
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 1898 1277.1
## 2 1895 1266.9 3 10.254 0.01653 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## [[1]]
## Analysis of Deviance Table
##
## Model 1: in_hospital_death ~ Age + ICUType + Albumin_min + Bilirubin_max +
## BUN_max + GCS_max + HR_max + Lactate_max + Na_min + pH_min +
## Temp_min + Urine_min + WBC_min + WBC_max
## Model 2: in_hospital_death ~ Age + ICUType + Albumin_min + Bilirubin_max +
## BUN_max + GCS_max + HR_max + Lactate_max + Na_min + pH_min +
## Temp_min + Urine_min + WBC_min + WBC_max + Age:Creatinine_max
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 1898 1277.1
## 2 1897 1275.6 1 1.4776 0.2242
##
## [[2]]
## Analysis of Deviance Table
##
## Model 1: in_hospital_death ~ Age + ICUType + Albumin_min + Bilirubin_max +
## BUN_max + GCS_max + HR_max + Lactate_max + Na_min + pH_min +
## Temp_min + Urine_min + WBC_min + WBC_max
## Model 2: in_hospital_death ~ Age + ICUType + Albumin_min + Bilirubin_max +
## BUN_max + GCS_max + HR_max + Lactate_max + Na_min + pH_min +
## Temp_min + Urine_min + WBC_min + WBC_max + Age:Temp_min
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 1898 1277.1
## 2 1897 1277.1 1 0.0025966 0.9594
##
## [[3]]
## Analysis of Deviance Table
##
## Model 1: in_hospital_death ~ Age + ICUType + Albumin_min + Bilirubin_max +
## BUN_max + GCS_max + HR_max + Lactate_max + Na_min + pH_min +
## Temp_min + Urine_min + WBC_min + WBC_max
## Model 2: in_hospital_death ~ Age + ICUType + Albumin_min + Bilirubin_max +
## BUN_max + GCS_max + HR_max + Lactate_max + Na_min + pH_min +
## Temp_min + Urine_min + WBC_min + WBC_max + Age:Weight_max
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 1898 1277.1
## 2 1897 1275.1 1 1.9802 0.1594
##
## [[4]]
## Analysis of Deviance Table
##
## Model 1: in_hospital_death ~ Age + ICUType + Albumin_min + Bilirubin_max +
## BUN_max + GCS_max + HR_max + Lactate_max + Na_min + pH_min +
## Temp_min + Urine_min + WBC_min + WBC_max
## Model 2: in_hospital_death ~ Age + ICUType + Albumin_min + Bilirubin_max +
## BUN_max + GCS_max + HR_max + Lactate_max + Na_min + pH_min +
## Temp_min + Urine_min + WBC_min + WBC_max + Age:Albumin_min
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 1898 1277.1
## 2 1897 1273.4 1 3.6995 0.05443 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## [[5]]
## Analysis of Deviance Table
##
## Model 1: in_hospital_death ~ Age + ICUType + Albumin_min + Bilirubin_max +
## BUN_max + GCS_max + HR_max + Lactate_max + Na_min + pH_min +
## Temp_min + Urine_min + WBC_min + WBC_max
## Model 2: in_hospital_death ~ Age + ICUType + Albumin_min + Bilirubin_max +
## BUN_max + GCS_max + HR_max + Lactate_max + Na_min + pH_min +
## Temp_min + Urine_min + WBC_min + WBC_max + Age:ICUType
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 1898 1277.1
## 2 1895 1266.9 3 10.254 0.01653 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Result: borderline effect for age:albumin (p=0.054)
## significant effect for age:icutype (p=0.016)
# Input the significant interactions into the model
finalICU_glm_interactions <- glm(in_hospital_death ~
Age +
ICUType +
Albumin_min +
Bilirubin_max +
BUN_max +
GCS_max +
HR_max +
Lactate_max +
Na_min +
pH_min +
Temp_min +
Urine_min +
WBC_min +
WBC_max +
# significant interaction terms
Age:ICUType + Age:Albumin_min
, data=nm_icu_model_df1, family="binomial")
summary(finalICU_glm_interactions) # AIC 1305 (lowest so far - lower than just including age:icutype)
##
## Call:
## glm(formula = in_hospital_death ~ Age + ICUType + Albumin_min +
## Bilirubin_max + BUN_max + GCS_max + HR_max + Lactate_max +
## Na_min + pH_min + Temp_min + Urine_min + WBC_min + WBC_max +
## Age:ICUType + Age:Albumin_min, family = "binomial", data = nm_icu_model_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.9494 -0.5533 -0.3360 -0.1854 3.2388
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 20.855206 6.365565 3.276 0.00105
## Age -0.018285 0.028752 -0.636 0.52480
## ICUTypeCardiac Surgery Recovery Unit -0.562192 1.733448 -0.324 0.74570
## ICUTypeMedical ICU -0.243286 1.265623 -0.192 0.84756
## ICUTypeSurgical ICU -2.505360 1.374546 -1.823 0.06835
## Albumin_min -1.384342 0.567281 -2.440 0.01467
## Bilirubin_max 0.048779 0.013523 3.607 0.00031
## BUN_max 0.018215 0.002902 6.276 3.47e-10
## GCS_max -0.178502 0.021748 -8.208 2.26e-16
## HR_max 0.008056 0.003232 2.492 0.01269
## Lactate_max 0.062277 0.033295 1.870 0.06142
## Na_min -0.038919 0.014253 -2.731 0.00632
## pH_min -1.084124 0.737653 -1.470 0.14164
## Temp_min -0.172788 0.079499 -2.173 0.02974
## Urine_min -0.006015 0.002511 -2.395 0.01660
## WBC_min 0.074082 0.025771 2.875 0.00405
## WBC_max -0.065411 0.021751 -3.007 0.00264
## Age:ICUTypeCardiac Surgery Recovery Unit -0.008024 0.023597 -0.340 0.73383
## Age:ICUTypeMedical ICU 0.004228 0.016843 0.251 0.80181
## Age:ICUTypeSurgical ICU 0.036583 0.018295 2.000 0.04554
## Age:Albumin_min 0.014994 0.007834 1.914 0.05563
##
## (Intercept) **
## Age
## ICUTypeCardiac Surgery Recovery Unit
## ICUTypeMedical ICU
## ICUTypeSurgical ICU .
## Albumin_min *
## Bilirubin_max ***
## BUN_max ***
## GCS_max ***
## HR_max *
## Lactate_max .
## Na_min **
## pH_min
## Temp_min *
## Urine_min *
## WBC_min **
## WBC_max **
## Age:ICUTypeCardiac Surgery Recovery Unit
## Age:ICUTypeMedical ICU
## Age:ICUTypeSurgical ICU *
## Age:Albumin_min .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1604.2 on 1914 degrees of freedom
## Residual deviance: 1263.2 on 1894 degrees of freedom
## AIC: 1305.2
##
## Number of Fisher Scoring iterations: 6
Test some interaction terms based on clinical knowledge
#
# #################################################################################
# # TO BE DELETED FROM HERE
#
#
#
# # based on clinical knowledge, test some interaction terms
# # add one new term on top of finalICU_glm per model
# # then compare models with interactions with baseline model
#
# # finalICU_glm_2 = finalICU_glm + Age:Creatinine_max
# finalICU_glm_2 <- glm(in_hospital_death ~
# # significant predictors from step()
# Age + SAPS1 + ICUType + Albumin_diff + Bilirubin_min +
# Bilirubin_diff + BUN_min + BUN_diff + Creatinine_max +
# GCS_max + Lactate_min + Na_min + Platelets_max +
# Temp_min + Urine_max + Urine_diff +
#
# # baseline demographics
# Gender + Length_of_stay + Weight_min + SOFA +
#
# # other clinical relevance
# Albumin_min + Glucose_max + HCT_min + HR_max + PaO2_min +
# PaCO2_min + pH_min + RespRate_max + TroponinT_max +
# WBC_max +
#
# # interaction term
# + Age:Creatinine_max # creatinine generally increases with age
# , data=icu_patients_df1, family="binomial")
#
# # finalICU_glm_3 = finalICU_glm + Age:Temp_min
# finalICU_glm_3 <- glm(in_hospital_death ~
# # significant predictors from step()
# Age + SAPS1 + ICUType + Albumin_diff + Bilirubin_min +
# Bilirubin_diff + BUN_min + BUN_diff + Creatinine_max +
# GCS_max + Lactate_min + Na_min + Platelets_max +
# Temp_min + Urine_max + Urine_diff +
#
# # baseline demographics
# Gender + Length_of_stay + Weight_min + SOFA +
#
# # other clinical relevance
# Albumin_min + Glucose_max + HCT_min + HR_max + PaO2_min +
# PaCO2_min + pH_min + RespRate_max + TroponinT_max +
# WBC_max +
#
# # interaction term
# + Age:Temp_min # low temp more often associated with illness in the elderly e.g. cold sepsis
# , data=icu_patients_df1, family="binomial")
#
# # finalICU_glm_4 = finalICU_glm + Age:Weight_min
# finalICU_glm_4 <- glm(in_hospital_death ~
# # significant predictors from step()
# Age + SAPS1 + ICUType + Albumin_diff + Bilirubin_min +
# Bilirubin_diff + BUN_min + BUN_diff + Creatinine_max +
# GCS_max + Lactate_min + Na_min + Platelets_max +
# Temp_min + Urine_max + Urine_diff +
#
# # baseline demographics
# Gender + Length_of_stay + Weight_min + SOFA +
#
# # other clinical relevance
# Albumin_min + Glucose_max + HCT_min + HR_max + PaO2_min +
# PaCO2_min + pH_min + RespRate_max + TroponinT_max +
# WBC_max +
#
# # interaction term
# + Age:Weight_min # weight generally decreases with age
# , data=icu_patients_df1, family="binomial")
#
# # finalICU_glm_5 = finalICU_glm + Age:Albumin_min
# finalICU_glm_5 <- glm(in_hospital_death ~
# # significant predictors from step()
# Age + SAPS1 + ICUType + Albumin_diff + Bilirubin_min +
# Bilirubin_diff + BUN_min + BUN_diff + Creatinine_max +
# GCS_max + Lactate_min + Na_min + Platelets_max +
# Temp_min + Urine_max + Urine_diff +
#
# # baseline demographics
# Gender + Length_of_stay + Weight_min + SOFA +
#
# # other clinical relevance
# Albumin_min + Glucose_max + HCT_min + HR_max + PaO2_min +
# PaCO2_min + pH_min + RespRate_max + TroponinT_max +
# WBC_max +
#
# # interaction term
# Age:Albumin_min # albumin can decrease with age
# , data=icu_patients_df1, family="binomial")
#
# # finalICU_glm_6 = finalICU_glm + Gender:HCT_min
# finalICU_glm_6 <- glm(in_hospital_death ~
# # significant predictors from step()
# Age + SAPS1 + ICUType + Albumin_diff + Bilirubin_min +
# Bilirubin_diff + BUN_min + BUN_diff + Creatinine_max +
# GCS_max + Lactate_min + Na_min + Platelets_max +
# Temp_min + Urine_max + Urine_diff +
#
# # baseline demographics
# Gender + Length_of_stay + Weight_min + SOFA +
#
# # other clinical relevance
# Albumin_min + Glucose_max + HCT_min + HR_max + PaO2_min +
# PaCO2_min + pH_min + RespRate_max + TroponinT_max +
# WBC_max +
#
# # interaction term
# Gender:HCT_min # HCT can be lower in females than males
# , data=icu_patients_df1, family="binomial")
#
# # finalICU_glm_7 = finalICU_glm + PaO2_min:RespRate_max
# finalICU_glm_7 <- glm(in_hospital_death ~
# # significant predictors from step()
# Age + SAPS1 + ICUType + Albumin_diff + Bilirubin_min +
# Bilirubin_diff + BUN_min + BUN_diff + Creatinine_max +
# GCS_max + Lactate_min + Na_min + Platelets_max +
# Temp_min + Urine_max + Urine_diff +
#
# # baseline demographics
# Gender + Length_of_stay + Weight_min + SOFA +
#
# # other clinical relevance
# Albumin_min + Glucose_max + HCT_min + HR_max + PaO2_min +
# PaCO2_min + pH_min + RespRate_max + TroponinT_max +
# WBC_max +
#
# # interaction term
# PaO2_min:RespRate_max # PaO2 and resp rate are intrinsically related physiologically
# , data=icu_patients_df1, family="binomial")
#
# # finalICU_glm_8 = finalICU_glm + Age:ICUType
# finalICU_glm_8 <- glm(in_hospital_death ~
# # significant predictors from step()
# Age + SAPS1 + ICUType + Albumin_diff + Bilirubin_min +
# Bilirubin_diff + BUN_min + BUN_diff + Creatinine_max +
# GCS_max + Lactate_min + Na_min + Platelets_max +
# Temp_min + Urine_max + Urine_diff +
#
# # baseline demographics
# Gender + Length_of_stay + Weight_min + SOFA +
#
# # other clinical relevance
# Albumin_min + Glucose_max + HCT_min + HR_max + PaO2_min +
# PaCO2_min + pH_min + RespRate_max + TroponinT_max +
# WBC_max +
#
# # interaction term
# Age:ICUType # age is likely to be related to ICU type
# # e.g. elderly more likely to have poor outcome after surgery requiring post-op ICU support
# , data=icu_patients_df1, family="binomial")
#
#
# # comparing models with anova
# lapply(list(finalICU_glm_2, finalICU_glm_3, finalICU_glm_4, finalICU_glm_5,
# finalICU_glm_6, finalICU_glm_7, finalICU_glm_8),
# function(x) {print(anova(finalICU_glm, x, test="Chisq"))} )
# # the effect of weight_min varied with age
# # the effect of ICUType varied with age
# # borderline -- the effect of resprate_max varied with PaO2_min
#
# ## feel free to add other interactions to test
#
#
# # input the significant interaction terms into a model and examine output
# finalICU_glm_9 <- glm(in_hospital_death ~
# # significant predictors from step()
# Age + SAPS1 + ICUType + Albumin_diff + Bilirubin_min +
# Bilirubin_diff + BUN_min + BUN_diff + Creatinine_max +
# GCS_max + Lactate_min + Na_min + Platelets_max +
# Temp_min + Urine_max + Urine_diff +
#
# # baseline demographics
# Gender + Length_of_stay + Weight_min + SOFA +
#
# # other clinical relevance
# Albumin_min + Glucose_max + HCT_min + HR_max + PaO2_min +
# PaCO2_min + pH_min + RespRate_max + TroponinT_max +
# WBC_max +
#
# # interaction terms
# Age:Weight_min + Age:ICUType # effects that had a significant effect on the model with anova
# , data=icu_patients_df1, family="binomial")
#
# summary(finalICU_glm_9)
# # the AIC is slightly lower than finalICU_glm
#
# ## the effects of the interactions have significance but the ORs are close to 1 with narrow CIs -- perhaps not very clinically informative (i.e. the odds are essentially 1 i.e. equal)
# options(scipen=999)
# exp(coef(finalICU_glm_9))
# exp(confint(finalICU_glm_9))
# TO BE DELETD FROM ABOVE TO HERE
#################################################################################
Testing the modified poisson regression, as the outcome is 14% in this data (>10% - common)
#################################################################################
# NEED TO DECIDE WHETHER TO INCLUDE THIS SECTION
# test using modified poisson regression for more common outcomes on the same covariates as above
finalICU_glm_poisson <- glm(in_hospital_death ~
# significant predictors from step()
Age + SAPS1 + ICUType + Albumin_diff + Bilirubin_min +
Bilirubin_diff + BUN_min + BUN_diff + Creatinine_max +
GCS_max + Lactate_min + Na_min + Platelets_max +
Temp_min + Urine_max + Urine_diff +
# baseline demographics should be included even if not significant
Gender + Length_of_stay + Weight_min +
SOFA + # an indicator of how well SOFA score determines mortality independent to its components
# other clinical relevance
Albumin_min + # low albumin indicates malnutrition or liver failure
Glucose_max + # hyperglycaemia is a stress response
HCT_min + # low HCT = anaemia
HR_max + # tachycardia may indicate septic shock / inflammation
PaO2_min + # hypoxia = inadequate organ perfusion/oxygenation
PaCO2_min + #hypercapnia = respiratory / ventilation failure
pH_min + # indicates acidaemia / inadequate organ perfusion
RespRate_max + # indicates respiratory failure
TroponinT_max + # indicates myocardial damage
WBC_max # indicates infection
, data=icu_patients_df1, family="poisson"(link="log"))
summary(finalICU_glm_poisson)
##
## Call:
## glm(formula = in_hospital_death ~ Age + SAPS1 + ICUType + Albumin_diff +
## Bilirubin_min + Bilirubin_diff + BUN_min + BUN_diff + Creatinine_max +
## GCS_max + Lactate_min + Na_min + Platelets_max + Temp_min +
## Urine_max + Urine_diff + Gender + Length_of_stay + Weight_min +
## SOFA + Albumin_min + Glucose_max + HCT_min + HR_max + PaO2_min +
## PaCO2_min + pH_min + RespRate_max + TroponinT_max + WBC_max,
## family = poisson(link = "log"), data = icu_patients_df1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.8744 -0.5069 -0.3491 -0.2183 2.4834
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 5.0214843 3.3904946 1.481 0.13859
## Age 0.0198792 0.0049400 4.024 5.72e-05 ***
## SAPS1 0.0339633 0.0204016 1.665 0.09596 .
## ICUTypeCardiac Surgery Recovery Unit -0.7603505 0.2813563 -2.702 0.00688 **
## ICUTypeMedical ICU 0.0629493 0.1935242 0.325 0.74497
## ICUTypeSurgical ICU 0.1931383 0.2185759 0.884 0.37690
## Albumin_diff 0.1457395 0.1641374 0.888 0.37459
## Bilirubin_min 0.1464095 0.0568473 2.575 0.01001 *
## Bilirubin_diff -0.1263382 0.0579171 -2.181 0.02916 *
## BUN_min 0.0292204 0.0068460 4.268 1.97e-05 ***
## BUN_diff -0.0157550 0.0068983 -2.284 0.02238 *
## Creatinine_max -0.0890083 0.0548536 -1.623 0.10466
## GCS_max -0.0990101 0.0213334 -4.641 3.47e-06 ***
## Lactate_min -0.0110473 0.0333359 -0.331 0.74035
## Na_min -0.0352725 0.0121226 -2.910 0.00362 **
## Platelets_max -0.0006707 0.0006484 -1.034 0.30096
## Temp_min -0.0647282 0.0531798 -1.217 0.22354
## Urine_max -0.0015792 0.0014410 -1.096 0.27312
## Urine_diff 0.0011907 0.0015125 0.787 0.43113
## GenderMale -0.0834178 0.1320252 -0.632 0.52750
## Length_of_stay -0.0042229 0.0048572 -0.869 0.38462
## Weight_min -0.0037488 0.0033072 -1.134 0.25700
## SOFA 0.0144047 0.0215427 0.669 0.50371
## Albumin_min -0.1336429 0.1048927 -1.274 0.20263
## Glucose_max 0.0001538 0.0006267 0.245 0.80608
## HCT_min -0.0108434 0.0126736 -0.856 0.39222
## HR_max 0.0052571 0.0026488 1.985 0.04718 *
## PaO2_min 0.0004131 0.0011102 0.372 0.70981
## PaCO2_min 0.0059266 0.0079216 0.748 0.45437
## pH_min -0.0847659 0.2631944 -0.322 0.74740
## RespRate_max 0.0095491 0.0085073 1.122 0.26167
## TroponinT_max 0.0334174 0.0247510 1.350 0.17697
## WBC_max -0.0071252 0.0086893 -0.820 0.41222
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 1046.23 on 1854 degrees of freedom
## Residual deviance: 769.47 on 1822 degrees of freedom
## (206 observations deleted due to missingness)
## AIC: 1381.5
##
## Number of Fisher Scoring iterations: 6
# fewer significant variables (likely as CI can be wider in poisson)
# but the variables that are significant were also significant in the logistic model
# examine ORs from logistic regression
options(scipen=999) # turn off scientific notation
exp(coef(finalICU_glm_interactions))
## (Intercept)
## 1141039705.79856825
## Age
## 0.98188117
## ICUTypeCardiac Surgery Recovery Unit
## 0.56995835
## ICUTypeMedical ICU
## 0.78404694
## ICUTypeSurgical ICU
## 0.08164616
## Albumin_min
## 0.25048853
## Bilirubin_max
## 1.04998791
## BUN_max
## 1.01838146
## GCS_max
## 0.83652254
## HR_max
## 1.00808840
## Lactate_max
## 1.06425731
## Na_min
## 0.96182843
## pH_min
## 0.33819783
## Temp_min
## 0.84131613
## Urine_min
## 0.99400267
## WBC_min
## 1.07689505
## WBC_max
## 0.93668260
## Age:ICUTypeCardiac Surgery Recovery Unit
## 0.99200823
## Age:ICUTypeMedical ICU
## 1.00423652
## Age:ICUTypeSurgical ICU
## 1.03725988
## Age:Albumin_min
## 1.01510738
# examine RRs from logistic regression
exp(coef(finalICU_glm_poisson))
## (Intercept) Age
## 151.6362129 1.0200782
## SAPS1 ICUTypeCardiac Surgery Recovery Unit
## 1.0345467 0.4675026
## ICUTypeMedical ICU ICUTypeSurgical ICU
## 1.0649728 1.2130505
## Albumin_diff Bilirubin_min
## 1.1568947 1.1576701
## Bilirubin_diff BUN_min
## 0.8813167 1.0296515
## BUN_diff Creatinine_max
## 0.9843684 0.9148380
## GCS_max Lactate_min
## 0.9057335 0.9890134
## Na_min Platelets_max
## 0.9653423 0.9993295
## Temp_min Urine_max
## 0.9373222 0.9984220
## Urine_diff GenderMale
## 1.0011914 0.9199667
## Length_of_stay Weight_min
## 0.9957860 0.9962582
## SOFA Albumin_min
## 1.0145089 0.8749024
## Glucose_max HCT_min
## 1.0001539 0.9892151
## HR_max PaO2_min
## 1.0052709 1.0004132
## PaCO2_min pH_min
## 1.0059442 0.9187274
## RespRate_max TroponinT_max
## 1.0095948 1.0339820
## WBC_max
## 0.9929001
# the ORs and RRs appear very similar --> check the actual differences
exp(coef(finalICU_glm_interactions))-exp(coef(finalICU_glm_poisson))
## Warning in exp(coef(finalICU_glm_interactions)) -
## exp(coef(finalICU_glm_poisson)): longer object length is not a multiple of
## shorter object length
## (Intercept) Age
## 1141039554.1623554230 -0.0381969906
## SAPS1 ICUTypeCardiac Surgery Recovery Unit
## -0.4645883206 0.3165443793
## ICUTypeMedical ICU ICUTypeSurgical ICU
## -0.9833266666 -0.9625620124
## Albumin_diff Bilirubin_min
## -0.1069068314 -0.1392886834
## Bilirubin_diff BUN_min
## -0.0447941859 -0.0215631185
## BUN_diff Creatinine_max
## 0.0798888748 0.0469904430
## GCS_max Lactate_min
## -0.5675356972 -0.1476973160
## Na_min Platelets_max
## 0.0286603803 0.0775655574
## Temp_min Urine_max
## -0.0006395689 -0.0064138009
## Urine_diff GenderMale
## 0.0030450858 0.1172931629
## Length_of_stay Weight_min
## 0.0193214104 1141039704.8023099899
## SOFA Albumin_min
## -0.0326277521 -0.3049440765
## Glucose_max HCT_min
## -0.2161069212 -0.9075689683
## HR_max PaO2_min
## -0.7547823984 0.0495747182
## PaCO2_min pH_min
## 0.0124372203 -0.0822048140
## RespRate_max TroponinT_max
## -0.0015063952 0.0302753110
## WBC_max
## -0.0310717102
# the intercept is very different (by 82000!) - not sure how to interpret that. the other estimates are very similar
# perhaps the logistic model is therefore justified? just need to be careful in interpretation using 'odds' rather than 'risk'
#################################################################################
library(magrittr)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following object is masked from 'package:gridExtra':
##
## combine
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
### Goodness of fit using bins df1 ###
# add predicted probabilities to the data frame
nm_icu_model_df1 %>% mutate(predprob=predict(finalICU_glm_interactions, type="response"),
linpred=predict(finalICU_glm_interactions)) %>%
# group the data into bins based on the linear predictor fitted values
group_by(cut(linpred, breaks=unique(quantile(linpred, (1:50)/51)))) %>%
# summarise by bin
summarise(death_bin=sum(in_hospital_death), predprob_bin=mean(predprob), n_bin=n()) %>%
# add the standard error of the mean predicted probaility for each bin
mutate(se_predprob_bin=sqrt(predprob_bin*(1 - predprob_bin)/n_bin)) %>%
# plot it with 95% confidence interval bars
ggplot(aes(x=predprob_bin,
y=death_bin/n_bin,
ymin=death_bin/n_bin - 1.96*se_predprob_bin,
ymax=death_bin/n_bin + 1.96*se_predprob_bin)) +
geom_point() + geom_linerange(colour="orange", alpha=0.4) +
geom_abline(intercept=0, slope=1) +
labs(x="Predicted probability (binned)",
y="Observed proportion (in each bin)")
# the ideal calibration line fits within most of the dots and their 95% CI
### Goodness of fit using Hosmer Lemeshow stat ###
nm_icu_model_df1 %>% mutate(predprob=predict(finalICU_glm_interactions, type="response"),
linpred=predict(finalICU_glm_interactions)) %>%
group_by(cut(linpred, breaks=unique(quantile(linpred, (1:50)/51)))) %>%
summarise(death_bin=sum(in_hospital_death), predprob_bin=mean(predprob), n_bin=n()) %>%
mutate(se_predprob_bin=sqrt(predprob_bin*(1 - predprob_bin)/n_bin)) -> hl_df
hl_stat <- with(hl_df, sum( (death_bin - n_bin*predprob_bin)^2 /
(n_bin* predprob_bin*(1 - predprob_bin))))
hl <- c(hosmer_lemeshow_stat=hl_stat, hl_degrees_freedom=nrow(hl_df) - 1)
hl
## hosmer_lemeshow_stat hl_degrees_freedom
## 51.77871 49.00000
# calculate p-value
c(p_val=1 - pchisq(hl[1], hl[2])) # the p value here is not statistically significant, indicating no lack of fit
## p_val.hosmer_lemeshow_stat
## 0.3659299
### Brier score ###
get_brier <- function(model){
predprob <- predict(model, type="response")
Brier_score <- mean((predprob - nm_icu_model_df1$in_hospital_death)^2)
return(Brier_score)
}
get_brier(finalICU_glm)
## [1] 0.1022154
get_brier(finalICU_glm_interactions)
## [1] 0.1012639
# the final model with interactions has slightly lower brier score -> lower score is better fit
### trying to fit our model to icu_patients_df0 data ###
### Commented out for now, in order to test knitting the file ###
# icu_patients_df0
# alot of missing data here also!
# for(i in 1:length(colnames(icu_patients_df0))){
# print(c(i,colnames(icu_patients_df0[i]), sum(is.na(icu_patients_df0[i]))))
# }
#
# # remove columns with too much missing data
# # arbitrary selection of >200
# # albumin, ALP, ALT, AST, bilirubin, cholesterol, diasABP, FiO2, lactate, MAP, NIDiasABP, NIMAP, NISSysABP
# # pH, RespRate, SaO2, Troponin
#
# icu_patients_df0_nm <- icu_patients_df0[, -c(10:24, 28:30, 34:39, 61:66, 73:90, 94:102, 106:111 )]
# icu_patients_df0_nm <- na.omit(icu_patients_df0_nm)
# ***haven't worked out how to fit our model into df0 data!!!***
Create your response to this task here, as a mixture of embedded (knitr) R code and any resulting outputs, and explanatory or commentary text.
In this task, you are required to develop a Cox proportional hazards survival model using the icu_patients_df1 data set which adequately explains or predicts the length of survival indicated by the Days variable, with censoring as indicated by the Status variable. You should fit a series of models, maybe three or four, evaluating each one, before you present your final model. Your final model should not include all the predictor variables, just a small subset of them, which you have selected based on statistical significance and/or background knowledge. Aim for between five and ten predictor variables (slightly more or fewer is OK). It is perfectly acceptable to include predictor variables in your final model which are not statistically significant, as long as you justify their inclusion on medical or physiological grounds (you will not be marked down if your medical justification is not exactly correct, but do you best). You should assess each model you consider for goodness of fit and other relevant statistics, and you should assess your final model for violations of assumptions and perform other diagnostics which you think are relevant (and modify the model if indicated, or at least comment on the possible impact of what your diagnostics show). Finally, re-fit your final model to the unimputed data frame (icu_patients_df0.rds) and comment on any differences you find.
#Survival anlaysis Data set up
library(survival)
library(eha)
library(stringi)
library(bshazard)
## Loading required package: splines
## Loading required package: Epi
library(survminer)
## Loading required package: ggpubr
#Available variables
head(icu_patients_df1)
## RecordID Length_of_stay SAPS1 SOFA Survival in_hospital_death Days Status Age
## 1 132539 5 6 1 NA 0 2408 FALSE 54
## 2 132540 8 16 8 NA 0 2408 FALSE 76
## 3 132541 19 21 11 NA 0 2408 FALSE 44
## 4 132543 9 7 1 575 0 575 TRUE 68
## 5 132545 4 17 2 918 0 918 TRUE 88
## 6 132547 6 14 11 1637 0 1637 TRUE 64
## Albumin_diff Albumin_max Albumin_min ALP_diff ALP_max ALP_min ALT_diff
## 1 0.2186633 3.2 3.1 118.147964 214 202 80.44617
## 2 0.8813367 2.1 2.2 252.147964 338 348 94.44617
## 3 0.6813367 2.7 2.3 31.147964 127 105 45.44617
## 4 1.4186633 4.4 4.4 9.147964 105 105 108.44617
## 5 0.3813367 2.7 2.6 56.852036 39 78 96.44617
## 6 0.4186633 3.4 3.3 5.147964 101 101 75.44617
## ALT_max ALT_min AST_diff AST_max AST_min Bilirubin_diff Bilirubin_max
## 1 40 75 131.35271 38 53 1.464039 0.4
## 2 206 26 116.35271 53 74 1.564039 1.2
## 3 91 75 65.64729 235 164 1.235961 3.0
## 4 12 12 154.35271 15 15 1.564039 0.2
## 5 24 32 154.35271 15 97 1.364039 0.4
## 6 60 45 122.35271 162 47 1.364039 0.4
## Bilirubin_min BUN_diff BUN_max BUN_min Cholesterol_diff Cholesterol_max
## 1 0.3 11.527053 13 13 16.42276 154
## 2 0.2 8.527053 18 16 28.42276 139
## 3 2.8 21.527053 8 3 56.42276 111
## 4 0.2 4.527053 23 20 37.42276 127
## 5 0.9 20.472947 45 45 55.42276 104
## 6 0.4 9.527053 19 15 55.57724 212
## Cholesterol_min Creatinine_diff Creatinine_max Creatinine_min DiasABP_diff
## 1 140 0.4324463 0.8 0.8 NA
## 2 128 0.4324463 1.2 0.8 26.54421
## 3 100 0.9324463 0.4 0.3 NA
## 4 119 0.5324463 0.9 0.7 NA
## 5 101 0.2324463 1.0 1.0 NA
## 6 212 0.3324463 1.4 0.9 20.45579
## DiasABP_max DiasABP_min FiO2_diff FiO2_max FiO2_min GCS_diff GCS_max GCS_min
## 1 NA NA 0.05192012 0.5 0.5 3.755971 15 15
## 2 81 32 0.44807988 1.0 0.4 8.244029 15 3
## 3 NA NA 0.44807988 1.0 0.5 6.244029 8 5
## 4 NA NA 0.44807988 1.0 0.4 3.755971 15 14
## 5 NA NA 0.15192012 0.4 0.5 3.755971 15 15
## 6 79 55 0.05192012 0.5 0.5 4.244029 9 7
## Gender Glucose_diff Glucose_max Glucose_min HCO3_diff HCO3_max HCO3_min
## 1 Female 65.14446 205 205 3.227452 26 26
## 2 Male 34.85554 105 105 1.772548 22 21
## 3 Female 20.85554 141 119 3.227452 26 24
## 4 Male 33.85554 129 106 5.227452 28 27
## 5 Female 26.85554 113 113 4.772548 18 18
## 6 Male 124.14446 264 197 3.772548 19 19
## HCT_diff HCT_max HCT_min Height HR_diff HR_max HR_min
## 1 2.739871 33.7 33.5 NA 29.077891 80 58
## 2 6.260129 29.7 24.7 175.3 7.077891 88 80
## 3 4.260129 28.5 26.7 NA 30.077891 113 57
## 4 10.339871 41.3 36.1 180.3 30.077891 88 57
## 5 8.360129 30.8 22.6 NA 20.077891 94 67
## 6 10.639871 41.6 36.8 180.3 16.077891 91 71
## ICUType K_diff K_max K_min Lactate_diff Lactate_max
## 1 Surgical ICU 0.2647934 4.4 4.4 0.9964037 1.9
## 2 Cardiac Surgery Recovery Unit 0.1647934 4.3 4.3 1.4964037 2.9
## 3 Medical ICU 4.4647934 8.6 3.3 1.4964037 1.9
## 4 Medical ICU 0.1352066 4.2 4.0 1.5964037 1.2
## 5 Medical ICU 1.8647934 6.0 3.8 0.8964037 2.0
## 6 Coronary Care Unit 0.9647934 5.1 3.8 1.8964037 0.9
## Lactate_min MAP_diff MAP_max MAP_min Mg_diff Mg_max Mg_min Na_diff Na_max
## 1 1.8 31.23164 109 56 0.4842982 1.5 1.5 2.2066071 137
## 2 1.3 34.76836 100 43 1.1157018 3.1 1.9 0.2066071 139
## 3 1.3 53.23164 131 71 0.6842982 1.9 1.3 2.2066071 140
## 4 1.5 24.23164 102 72 0.1157018 2.1 2.1 1.7933929 141
## 5 1.9 9.76836 78 68 0.4842982 1.5 1.5 0.7933929 140
## 6 1.3 24.23164 102 62 0.2842982 1.7 1.7 2.2066071 141
## Na_min NIDiasABP_diff NIDiasABP_max NIDiasABP_min NIMAP_diff NIMAP_max
## 1 137 17.49101 65 40 17.04069 92.33
## 2 139 19.49101 65 38 26.38069 86.33
## 3 137 37.50899 95 66 34.28931 110.00
## 4 140 23.50899 81 54 24.98931 100.70
## 5 140 38.50899 96 29 29.98931 105.70
## 6 137 31.50899 89 52 26.58931 102.30
## NIMAP_min NISysABP_diff NISysABP_max NISysABP_min PaCO2_diff PaCO2_max
## 1 58.67 40.30125 157 96 3.335797 37
## 2 49.33 44.69875 129 72 7.335797 41
## 3 83.33 33.30125 150 111 3.335797 37
## 4 73.00 23.30125 140 102 9.335797 38
## 5 63.67 39.30125 156 119 6.335797 34
## 6 61.67 35.69875 129 81 5.335797 45
## PaCO2_min PaO2_diff PaO2_max PaO2_min pH_diff pH_max pH_min Platelets_diff
## 1 38 47.61789 186 111 0.12011376 7.49 7.43 31.23069
## 2 33 286.38211 445 89 0.08011376 7.45 7.34 36.23069
## 3 37 93.61789 65 65 0.14011376 7.51 7.51 117.76931
## 4 31 94.61789 148 64 0.14011376 7.51 7.47 201.23069
## 5 35 80.61789 78 84 0.04011376 7.38 7.41 80.76931
## 6 35 80.61789 101 78 0.07988624 7.40 7.29 86.23069
## Platelets_max Platelets_min RespRate_diff RespRate_max RespRate_min SaO2_diff
## 1 221 221 7.34858 24 12 3.246079
## 2 226 164 16.65142 36 11 1.753921
## 3 84 72 13.65142 33 18 2.246079
## 4 391 315 7.34858 21 12 1.753921
## 5 109 109 6.65142 26 15 3.246079
## 6 276 219 27.65142 47 20 1.246079
## SaO2_max SaO2_min SysABP_diff SysABP_max SysABP_min Temp_diff Temp_max
## 1 98 94 NA NA NA 1.874083 38.1
## 2 99 97 50.3105 135 66 2.474083 37.9
## 3 95 95 NA NA NA 2.025917 39.0
## 4 99 97 NA NA NA 1.874083 36.7
## 5 97 94 NA NA NA 1.174083 37.8
## 6 97 96 43.3105 152 73 1.174083 37.8
## Temp_min TroponinI_diff TroponinI_max TroponinI_min TroponinT_diff
## 1 35.1 5.1429448 1.0 0.3 0.4785006
## 2 34.5 26.2570552 31.7 16.1 0.6485006
## 3 36.7 31.2570552 33.4 36.7 0.8814994
## 4 35.1 0.8570552 5.9 6.3 0.6485006
## 5 35.8 0.1570552 5.6 5.6 0.6085006
## 6 35.8 4.1429448 1.3 1.3 0.6385006
## TroponinT_max TroponinT_min Urine_diff Urine_max Urine_min WBC_diff WBC_max
## 1 0.58 0.19 800.78242 900 30 0.9331524 11.2
## 2 0.43 0.02 670.78242 770 0 4.7331524 13.1
## 3 1.55 1.41 310.78242 410 30 8.4331524 4.2
## 4 0.10 0.02 600.78242 700 100 3.3331524 11.5
## 5 0.06 0.37 83.21758 150 16 8.3331524 3.8
## 6 0.03 0.10 1100.78242 1200 40 11.8668476 24.0
## WBC_min Weight_diff Weight_max Weight_min PFratio
## 1 11.2 NA NA NA 222
## 2 7.4 4.699878 80.6 76.0 89
## 3 3.7 23.999878 56.7 56.7 65
## 4 8.8 3.900122 84.6 84.6 64
## 5 3.8 NA NA NA 210
## 6 14.4 33.300122 114.0 114.0 156
**Selecting an initial subset of explanatory variables:
To select a subset of explanatory variables our group of investigators will examine the SAPS1 score and the SOFA score included in the dataset in more detail to ascertain the variables that might be logically associated with increased mortality and poor survival. We will also assess the APACHE score which is commonly used in ICU risk predcition models.
SAPS1 - Simplified Acute Physiology Score is a measure of the severity of disease for patients admitted to ICU. The following measures increases the SAPS1 score:
SOFA - sequential organ failure assessment is a predictor of ICU mortality. The following measures increase the SOFA score: Elevated PaO2/ FiO2 ratio- * Reduced GCS - Nervous system * Reduced MAP - Cardiovascular system * Administration of vasopressors - Cardiovascular system * High Bilirubin - Liver * Low Platelets - Coagulation * High Creatinine - Kidneys * Low Urine - Kidneys
*The APACHE score is commonly used validated risk score for ICU risk prediction. The variables that increase the APACHE score include:
Advanced Age
High or Low Temperature
High or Low MAP
High or Low HR
High or Low Respiratory Rate
High PaO2/FiO2 ratio
High or Low pH
High or Low Na
High or Low K
High Creatinine
High or low HCT
High or Low WBC
For our analysis, we will include variables that will increase SOFA, SAPS or APACHE scores. eg: increased BUN and reduced HCO3 will increase the SAPS score, therfore we will include BUN max(but not BUN_min and BUN_diff) and HCO3_min (but not HCO3_max and HCO3_diff). Where both extremes of a variable will increase the risk score, both min and max variables will be included.
Other factors known to be associated with morbidity/ mortality not included in risk scores:
BELOW IS A LIST OF THE VARIABLES TO BE INCLUDED: DEMOGRAPHIC VARAIBLES: * Age * Gender * ICU Type * Height * Weight_max
CLINICAL VARIABLES: * Albumin_min * Bilirubin_max * BUN_max * Creatinine_max
* GCS_min * Glucose_min and Glucose_max * HCO3_min * HR_min and HR_max * K_min K_max * Lactate_max * MAP_min
* Na_min and Na_max * NISysABP_min and NISysABP_max * Platelets_min * FiO2_max and PaO2_min - included as PFratio: PaO2_min/ FiO2_max * pH_min and pH_max * RespRate_min and RespRate_max * Temp_min and Temp_max * TroponinI_max * TroponinT_max * Urine_min * WBC_min and WBC_max
# Outcome variables
unique_icu = unique(subset(icu_patients_df1, select = c(RecordID)))
dim(unique_icu) # There are 2061 unique individuals
## [1] 2061 1
table(icu_patients_df1$Status) #773 censored out of 2061 observations
##
## FALSE TRUE
## 1288 773
# Plot KM survival curve (non-parametric)
ICU.fit <- survfit( Surv(Days, Status) ~ 1, data = icu_patients_df1)
print(ICU.fit, print.rmean = TRUE)
## Call: survfit(formula = Surv(Days, Status) ~ 1, data = icu_patients_df1)
##
## n events *rmean *se(rmean) median 0.95LCL 0.95UCL
## 2061.0 773.0 1633.5 23.1 NA NA NA
## * restricted mean with upper limit = 2408
summary(ICU.fit)
## Call: survfit(formula = Surv(Days, Status) ~ 1, data = icu_patients_df1)
##
## time n.risk n.event survival std.err lower 95% CI upper 95% CI
## 0 2061 2 0.999 0.000686 0.998 1.000
## 1 2059 16 0.991 0.002050 0.987 0.995
## 2 2043 26 0.979 0.003184 0.972 0.985
## 3 2017 30 0.964 0.004098 0.956 0.972
## 4 1987 20 0.954 0.004596 0.945 0.963
## 5 1967 22 0.944 0.005077 0.934 0.954
## 6 1945 13 0.937 0.005336 0.927 0.948
## 7 1932 18 0.929 0.005669 0.918 0.940
## 8 1914 11 0.923 0.005860 0.912 0.935
## 9 1903 24 0.912 0.006250 0.900 0.924
## 10 1879 16 0.904 0.006491 0.891 0.917
## 11 1863 13 0.898 0.006677 0.885 0.911
## 12 1850 13 0.891 0.006856 0.878 0.905
## 13 1837 8 0.887 0.006962 0.874 0.901
## 14 1829 6 0.885 0.007040 0.871 0.898
## 15 1823 11 0.879 0.007179 0.865 0.893
## 16 1812 9 0.875 0.007289 0.861 0.889
## 17 1803 8 0.871 0.007385 0.857 0.886
## 18 1795 4 0.869 0.007432 0.855 0.884
## 19 1791 7 0.866 0.007513 0.851 0.880
## 20 1784 5 0.863 0.007570 0.848 0.878
## 21 1779 8 0.859 0.007659 0.844 0.874
## 22 1771 3 0.858 0.007692 0.843 0.873
## 23 1768 3 0.856 0.007725 0.841 0.872
## 24 1765 3 0.855 0.007757 0.840 0.870
## 25 1762 4 0.853 0.007800 0.838 0.868
## 26 1758 3 0.852 0.007832 0.836 0.867
## 27 1755 3 0.850 0.007864 0.835 0.866
## 28 1752 3 0.849 0.007895 0.833 0.864
## 29 1749 2 0.848 0.007916 0.832 0.863
## 30 1747 2 0.847 0.007936 0.831 0.862
## 31 1745 5 0.844 0.007987 0.829 0.860
## 32 1740 1 0.844 0.007998 0.828 0.860
## 33 1739 2 0.843 0.008018 0.827 0.859
## 34 1737 1 0.842 0.008028 0.827 0.858
## 35 1736 1 0.842 0.008038 0.826 0.858
## 36 1735 3 0.840 0.008068 0.825 0.856
## 37 1732 1 0.840 0.008078 0.824 0.856
## 38 1731 4 0.838 0.008117 0.822 0.854
## 39 1727 3 0.836 0.008146 0.821 0.853
## 40 1724 1 0.836 0.008156 0.820 0.852
## 41 1723 3 0.835 0.008185 0.819 0.851
## 42 1720 1 0.834 0.008195 0.818 0.850
## 45 1719 2 0.833 0.008214 0.817 0.849
## 46 1717 3 0.832 0.008242 0.816 0.848
## 47 1714 2 0.831 0.008261 0.815 0.847
## 48 1712 3 0.829 0.008289 0.813 0.846
## 49 1709 1 0.829 0.008299 0.813 0.845
## 50 1708 3 0.827 0.008327 0.811 0.844
## 51 1705 1 0.827 0.008336 0.811 0.843
## 52 1704 1 0.826 0.008345 0.810 0.843
## 53 1703 1 0.826 0.008354 0.810 0.842
## 54 1702 1 0.825 0.008363 0.809 0.842
## 55 1701 2 0.824 0.008382 0.808 0.841
## 56 1699 3 0.823 0.008409 0.807 0.840
## 57 1696 1 0.822 0.008418 0.806 0.839
## 58 1695 2 0.821 0.008436 0.805 0.838
## 60 1693 5 0.819 0.008481 0.803 0.836
## 61 1688 3 0.818 0.008507 0.801 0.834
## 62 1685 1 0.817 0.008516 0.801 0.834
## 63 1684 1 0.817 0.008525 0.800 0.833
## 64 1683 1 0.816 0.008533 0.800 0.833
## 65 1682 5 0.814 0.008577 0.797 0.831
## 66 1677 2 0.813 0.008594 0.796 0.830
## 68 1675 2 0.812 0.008611 0.795 0.829
## 69 1673 2 0.811 0.008628 0.794 0.828
## 70 1671 1 0.810 0.008636 0.794 0.827
## 73 1670 3 0.809 0.008662 0.792 0.826
## 76 1667 1 0.808 0.008670 0.792 0.826
## 78 1666 1 0.808 0.008678 0.791 0.825
## 80 1665 1 0.807 0.008687 0.791 0.825
## 81 1664 1 0.807 0.008695 0.790 0.824
## 82 1663 1 0.806 0.008703 0.790 0.824
## 84 1662 1 0.806 0.008712 0.789 0.823
## 85 1661 1 0.805 0.008720 0.789 0.823
## 86 1660 3 0.804 0.008744 0.787 0.821
## 87 1657 1 0.803 0.008753 0.787 0.821
## 88 1656 1 0.803 0.008761 0.786 0.820
## 90 1655 1 0.803 0.008769 0.786 0.820
## 93 1654 1 0.802 0.008777 0.785 0.819
## 95 1653 2 0.801 0.008793 0.784 0.818
## 96 1651 1 0.801 0.008801 0.784 0.818
## 97 1650 1 0.800 0.008809 0.783 0.818
## 98 1649 1 0.800 0.008817 0.783 0.817
## 99 1648 1 0.799 0.008825 0.782 0.817
## 102 1647 1 0.799 0.008833 0.782 0.816
## 103 1646 2 0.798 0.008849 0.781 0.815
## 104 1644 3 0.796 0.008873 0.779 0.814
## 105 1641 3 0.795 0.008896 0.778 0.812
## 109 1638 2 0.794 0.008912 0.777 0.811
## 111 1636 1 0.793 0.008920 0.776 0.811
## 112 1635 3 0.792 0.008943 0.775 0.810
## 114 1632 1 0.791 0.008950 0.774 0.809
## 116 1631 1 0.791 0.008958 0.774 0.809
## 120 1630 1 0.790 0.008966 0.773 0.808
## 126 1629 1 0.790 0.008973 0.773 0.808
## 127 1628 1 0.789 0.008981 0.772 0.807
## 128 1627 3 0.788 0.009004 0.771 0.806
## 129 1624 1 0.787 0.009011 0.770 0.805
## 130 1623 1 0.787 0.009019 0.770 0.805
## 132 1622 2 0.786 0.009034 0.769 0.804
## 133 1620 1 0.786 0.009041 0.768 0.803
## 134 1619 1 0.785 0.009048 0.768 0.803
## 135 1618 1 0.785 0.009056 0.767 0.803
## 138 1617 1 0.784 0.009063 0.767 0.802
## 140 1616 1 0.784 0.009071 0.766 0.802
## 141 1615 2 0.783 0.009085 0.765 0.801
## 142 1613 1 0.782 0.009093 0.765 0.800
## 143 1612 1 0.782 0.009100 0.764 0.800
## 144 1611 1 0.781 0.009107 0.764 0.799
## 145 1610 2 0.780 0.009122 0.763 0.798
## 149 1608 2 0.779 0.009136 0.762 0.797
## 151 1606 1 0.779 0.009143 0.761 0.797
## 157 1605 1 0.778 0.009150 0.761 0.796
## 159 1604 1 0.778 0.009158 0.760 0.796
## 162 1603 2 0.777 0.009172 0.759 0.795
## 163 1601 1 0.776 0.009179 0.759 0.795
## 166 1600 2 0.775 0.009193 0.758 0.794
## 168 1598 1 0.775 0.009200 0.757 0.793
## 173 1597 1 0.774 0.009207 0.757 0.793
## 174 1596 1 0.774 0.009214 0.756 0.792
## 175 1595 1 0.773 0.009221 0.756 0.792
## 177 1594 1 0.773 0.009228 0.755 0.791
## 179 1593 3 0.771 0.009249 0.754 0.790
## 181 1590 2 0.770 0.009263 0.753 0.789
## 183 1588 3 0.769 0.009283 0.751 0.787
## 184 1585 1 0.769 0.009290 0.751 0.787
## 185 1584 1 0.768 0.009297 0.750 0.787
## 186 1583 1 0.768 0.009304 0.750 0.786
## 187 1582 1 0.767 0.009310 0.749 0.786
## 193 1581 1 0.767 0.009317 0.749 0.785
## 195 1580 2 0.766 0.009331 0.748 0.784
## 197 1578 3 0.764 0.009351 0.746 0.783
## 198 1575 1 0.764 0.009357 0.746 0.782
## 202 1574 1 0.763 0.009364 0.745 0.782
## 203 1573 2 0.762 0.009377 0.744 0.781
## 204 1571 1 0.762 0.009384 0.744 0.780
## 206 1570 2 0.761 0.009397 0.743 0.779
## 208 1568 1 0.760 0.009403 0.742 0.779
## 214 1567 2 0.759 0.009416 0.741 0.778
## 217 1565 1 0.759 0.009423 0.741 0.778
## 219 1564 1 0.758 0.009429 0.740 0.777
## 223 1563 1 0.758 0.009436 0.740 0.777
## 226 1562 1 0.757 0.009442 0.739 0.776
## 227 1561 1 0.757 0.009449 0.739 0.776
## 232 1560 2 0.756 0.009461 0.738 0.775
## 234 1558 1 0.755 0.009468 0.737 0.774
## 236 1557 1 0.755 0.009474 0.737 0.774
## 237 1556 3 0.754 0.009493 0.735 0.772
## 238 1553 1 0.753 0.009499 0.735 0.772
## 245 1552 1 0.753 0.009505 0.734 0.771
## 247 1551 1 0.752 0.009512 0.734 0.771
## 248 1550 1 0.752 0.009518 0.733 0.770
## 252 1549 1 0.751 0.009524 0.733 0.770
## 254 1548 1 0.751 0.009530 0.732 0.770
## 261 1547 1 0.750 0.009537 0.732 0.769
## 265 1546 1 0.750 0.009543 0.731 0.769
## 267 1545 1 0.749 0.009549 0.731 0.768
## 269 1544 6 0.746 0.009585 0.728 0.765
## 277 1538 1 0.746 0.009591 0.727 0.765
## 280 1537 1 0.745 0.009598 0.727 0.764
## 282 1536 1 0.745 0.009604 0.726 0.764
## 284 1535 1 0.744 0.009610 0.726 0.763
## 286 1534 2 0.743 0.009621 0.725 0.762
## 293 1532 1 0.743 0.009627 0.724 0.762
## 294 1531 1 0.742 0.009633 0.724 0.761
## 296 1530 2 0.741 0.009645 0.723 0.761
## 298 1528 2 0.740 0.009657 0.722 0.760
## 301 1526 2 0.739 0.009669 0.721 0.759
## 304 1524 1 0.739 0.009674 0.720 0.758
## 307 1523 1 0.738 0.009680 0.720 0.758
## 311 1522 1 0.738 0.009686 0.719 0.757
## 317 1521 1 0.738 0.009692 0.719 0.757
## 321 1520 1 0.737 0.009698 0.718 0.756
## 322 1519 1 0.737 0.009703 0.718 0.756
## 323 1518 1 0.736 0.009709 0.717 0.755
## 331 1517 1 0.736 0.009715 0.717 0.755
## 335 1516 2 0.735 0.009726 0.716 0.754
## 336 1514 1 0.734 0.009732 0.715 0.753
## 338 1513 1 0.734 0.009737 0.715 0.753
## 343 1512 1 0.733 0.009743 0.714 0.752
## 344 1511 1 0.733 0.009749 0.714 0.752
## 345 1510 1 0.732 0.009754 0.713 0.752
## 346 1509 1 0.732 0.009760 0.713 0.751
## 347 1508 1 0.731 0.009766 0.712 0.751
## 349 1507 1 0.731 0.009771 0.712 0.750
## 350 1506 1 0.730 0.009777 0.711 0.750
## 352 1505 1 0.730 0.009782 0.711 0.749
## 354 1504 1 0.729 0.009788 0.710 0.749
## 356 1503 1 0.729 0.009793 0.710 0.748
## 363 1502 1 0.728 0.009799 0.709 0.748
## 365 1501 1 0.728 0.009804 0.709 0.747
## 370 1500 2 0.727 0.009815 0.708 0.746
## 376 1498 1 0.726 0.009820 0.707 0.746
## 381 1497 1 0.726 0.009826 0.707 0.745
## 382 1496 1 0.725 0.009831 0.706 0.745
## 386 1495 1 0.725 0.009837 0.706 0.744
## 390 1494 2 0.724 0.009847 0.705 0.743
## 391 1492 1 0.723 0.009853 0.704 0.743
## 395 1491 1 0.723 0.009858 0.704 0.743
## 400 1490 2 0.722 0.009869 0.703 0.742
## 402 1488 1 0.721 0.009874 0.702 0.741
## 404 1487 1 0.721 0.009879 0.702 0.741
## 412 1486 2 0.720 0.009890 0.701 0.740
## 413 1484 1 0.720 0.009895 0.700 0.739
## 417 1483 1 0.719 0.009900 0.700 0.739
## 420 1482 1 0.719 0.009905 0.699 0.738
## 427 1481 1 0.718 0.009911 0.699 0.738
## 435 1480 1 0.718 0.009916 0.698 0.737
## 441 1479 1 0.717 0.009921 0.698 0.737
## 447 1478 1 0.717 0.009926 0.697 0.736
## 449 1477 1 0.716 0.009931 0.697 0.736
## 458 1476 1 0.716 0.009936 0.696 0.735
## 459 1475 1 0.715 0.009941 0.696 0.735
## 463 1474 2 0.714 0.009952 0.695 0.734
## 473 1472 1 0.714 0.009957 0.694 0.734
## 490 1471 1 0.713 0.009962 0.694 0.733
## 494 1470 2 0.712 0.009972 0.693 0.732
## 496 1468 1 0.712 0.009977 0.693 0.732
## 506 1467 1 0.711 0.009982 0.692 0.731
## 514 1466 1 0.711 0.009987 0.692 0.731
## 515 1465 1 0.710 0.009992 0.691 0.730
## 526 1464 1 0.710 0.009997 0.691 0.730
## 527 1463 2 0.709 0.010007 0.690 0.729
## 535 1461 1 0.708 0.010011 0.689 0.728
## 541 1460 1 0.708 0.010016 0.689 0.728
## 545 1459 1 0.707 0.010021 0.688 0.727
## 548 1458 1 0.707 0.010026 0.688 0.727
## 558 1457 1 0.706 0.010031 0.687 0.726
## 559 1456 1 0.706 0.010036 0.687 0.726
## 561 1455 1 0.705 0.010041 0.686 0.725
## 563 1454 1 0.705 0.010045 0.686 0.725
## 575 1453 1 0.705 0.010050 0.685 0.724
## 579 1452 1 0.704 0.010055 0.685 0.724
## 582 1451 1 0.704 0.010060 0.684 0.724
## 589 1450 1 0.703 0.010065 0.684 0.723
## 593 1449 1 0.703 0.010069 0.683 0.723
## 607 1448 1 0.702 0.010074 0.683 0.722
## 609 1447 1 0.702 0.010079 0.682 0.722
## 610 1446 1 0.701 0.010083 0.682 0.721
## 611 1445 2 0.700 0.010093 0.681 0.720
## 615 1443 1 0.700 0.010097 0.680 0.720
## 623 1442 2 0.699 0.010107 0.679 0.719
## 628 1440 1 0.698 0.010111 0.679 0.718
## 647 1439 1 0.698 0.010116 0.678 0.718
## 653 1438 1 0.697 0.010121 0.678 0.717
## 682 1437 1 0.697 0.010125 0.677 0.717
## 683 1436 1 0.696 0.010130 0.677 0.716
## 693 1435 1 0.696 0.010134 0.676 0.716
## 700 1434 1 0.695 0.010139 0.676 0.715
## 701 1433 1 0.695 0.010143 0.675 0.715
## 713 1432 1 0.694 0.010148 0.675 0.715
## 719 1431 1 0.694 0.010152 0.674 0.714
## 726 1430 1 0.693 0.010157 0.674 0.714
## 730 1429 1 0.693 0.010161 0.673 0.713
## 731 1428 1 0.692 0.010166 0.673 0.713
## 740 1427 2 0.691 0.010175 0.672 0.712
## 743 1425 1 0.691 0.010179 0.671 0.711
## 775 1424 1 0.690 0.010183 0.671 0.711
## 776 1423 1 0.690 0.010188 0.670 0.710
## 778 1422 1 0.689 0.010192 0.670 0.710
## 795 1421 1 0.689 0.010197 0.669 0.709
## 808 1420 1 0.689 0.010201 0.669 0.709
## 811 1419 1 0.688 0.010205 0.668 0.708
## 814 1418 1 0.688 0.010210 0.668 0.708
## 820 1417 1 0.687 0.010214 0.667 0.707
## 833 1416 2 0.686 0.010223 0.666 0.706
## 839 1414 1 0.686 0.010227 0.666 0.706
## 844 1413 1 0.685 0.010231 0.665 0.705
## 847 1412 2 0.684 0.010240 0.664 0.705
## 850 1410 1 0.684 0.010244 0.664 0.704
## 858 1409 1 0.683 0.010248 0.663 0.704
## 860 1408 1 0.683 0.010252 0.663 0.703
## 878 1407 1 0.682 0.010256 0.662 0.703
## 895 1406 1 0.682 0.010261 0.662 0.702
## 917 1405 1 0.681 0.010265 0.661 0.702
## 918 1404 2 0.680 0.010273 0.660 0.701
## 926 1402 2 0.679 0.010281 0.659 0.700
## 931 1400 1 0.679 0.010285 0.659 0.699
## 933 1399 1 0.678 0.010289 0.658 0.699
## 946 1398 1 0.678 0.010294 0.658 0.698
## 958 1397 2 0.677 0.010302 0.657 0.697
## 965 1395 1 0.676 0.010306 0.656 0.697
## 972 1394 1 0.676 0.010310 0.656 0.696
## 975 1393 1 0.675 0.010314 0.655 0.696
## 976 1392 1 0.675 0.010318 0.655 0.695
## 977 1391 1 0.674 0.010322 0.655 0.695
## 981 1390 1 0.674 0.010326 0.654 0.694
## 988 1389 1 0.673 0.010330 0.654 0.694
## 994 1388 1 0.673 0.010334 0.653 0.694
## 1001 1387 1 0.672 0.010338 0.653 0.693
## 1011 1386 1 0.672 0.010341 0.652 0.693
## 1012 1385 1 0.672 0.010345 0.652 0.692
## 1018 1384 1 0.671 0.010349 0.651 0.692
## 1039 1383 1 0.671 0.010353 0.651 0.691
## 1045 1382 1 0.670 0.010357 0.650 0.691
## 1046 1381 2 0.669 0.010365 0.649 0.690
## 1061 1379 1 0.669 0.010369 0.649 0.689
## 1068 1378 1 0.668 0.010372 0.648 0.689
## 1079 1377 1 0.668 0.010376 0.648 0.688
## 1082 1376 1 0.667 0.010380 0.647 0.688
## 1094 1375 1 0.667 0.010384 0.647 0.687
## 1096 1374 1 0.666 0.010388 0.646 0.687
## 1099 1373 1 0.666 0.010391 0.646 0.686
## 1100 1372 1 0.665 0.010395 0.645 0.686
## 1101 1371 1 0.665 0.010399 0.645 0.685
## 1106 1370 1 0.664 0.010403 0.644 0.685
## 1139 1369 1 0.664 0.010406 0.644 0.684
## 1162 1368 1 0.663 0.010410 0.643 0.684
## 1167 1367 1 0.663 0.010414 0.643 0.684
## 1171 1366 1 0.662 0.010417 0.642 0.683
## 1181 1365 1 0.662 0.010421 0.642 0.683
## 1216 1364 1 0.661 0.010425 0.641 0.682
## 1226 1363 1 0.661 0.010428 0.641 0.682
## 1233 1362 1 0.660 0.010432 0.640 0.681
## 1235 1361 1 0.660 0.010435 0.640 0.681
## 1252 1360 1 0.659 0.010439 0.639 0.680
## 1267 1359 1 0.659 0.010443 0.639 0.680
## 1269 1358 1 0.658 0.010446 0.638 0.679
## 1289 1357 1 0.658 0.010450 0.638 0.679
## 1318 1356 2 0.657 0.010457 0.637 0.678
## 1321 1354 1 0.656 0.010460 0.636 0.677
## 1326 1353 1 0.656 0.010464 0.636 0.677
## 1344 1352 1 0.656 0.010467 0.635 0.676
## 1353 1351 1 0.655 0.010471 0.635 0.676
## 1356 1350 1 0.655 0.010474 0.634 0.675
## 1359 1349 1 0.654 0.010478 0.634 0.675
## 1367 1348 1 0.654 0.010481 0.633 0.674
## 1408 1347 1 0.653 0.010485 0.633 0.674
## 1413 1346 1 0.653 0.010488 0.632 0.673
## 1415 1345 1 0.652 0.010492 0.632 0.673
## 1419 1344 1 0.652 0.010495 0.631 0.673
## 1422 1343 1 0.651 0.010498 0.631 0.672
## 1438 1342 1 0.651 0.010502 0.630 0.672
## 1444 1341 1 0.650 0.010505 0.630 0.671
## 1451 1340 1 0.650 0.010509 0.629 0.671
## 1459 1339 1 0.649 0.010512 0.629 0.670
## 1473 1338 1 0.649 0.010515 0.628 0.670
## 1482 1337 1 0.648 0.010519 0.628 0.669
## 1486 1336 1 0.648 0.010522 0.627 0.669
## 1488 1335 1 0.647 0.010525 0.627 0.668
## 1497 1334 1 0.647 0.010528 0.626 0.668
## 1537 1333 1 0.646 0.010532 0.626 0.667
## 1538 1332 1 0.646 0.010535 0.625 0.667
## 1548 1331 1 0.645 0.010538 0.625 0.666
## 1557 1330 1 0.645 0.010541 0.624 0.666
## 1562 1329 1 0.644 0.010545 0.624 0.665
## 1571 1328 1 0.644 0.010548 0.624 0.665
## 1590 1327 1 0.643 0.010551 0.623 0.664
## 1599 1326 1 0.643 0.010554 0.623 0.664
## 1601 1325 1 0.642 0.010557 0.622 0.663
## 1604 1324 1 0.642 0.010561 0.622 0.663
## 1637 1323 1 0.641 0.010564 0.621 0.662
## 1641 1322 1 0.641 0.010567 0.621 0.662
## 1670 1321 1 0.640 0.010570 0.620 0.662
## 1672 1320 1 0.640 0.010573 0.620 0.661
## 1692 1319 1 0.639 0.010576 0.619 0.661
## 1711 1318 1 0.639 0.010579 0.619 0.660
## 1718 1317 1 0.639 0.010583 0.618 0.660
## 1751 1316 1 0.638 0.010586 0.618 0.659
## 1758 1315 1 0.638 0.010589 0.617 0.659
## 1776 1314 1 0.637 0.010592 0.617 0.658
## 1780 1313 1 0.637 0.010595 0.616 0.658
## 1853 1312 1 0.636 0.010598 0.616 0.657
## 1858 1311 1 0.636 0.010601 0.615 0.657
## 1873 1310 1 0.635 0.010604 0.615 0.656
## 1889 1309 1 0.635 0.010607 0.614 0.656
## 1955 1308 1 0.634 0.010610 0.614 0.655
## 1967 1307 1 0.634 0.010613 0.613 0.655
## 1972 1306 1 0.633 0.010616 0.613 0.654
## 1988 1305 1 0.633 0.010619 0.612 0.654
## 2009 1304 1 0.632 0.010622 0.612 0.653
## 2011 1303 1 0.632 0.010625 0.611 0.653
## 2013 1302 1 0.631 0.010627 0.611 0.652
## 2014 1301 1 0.631 0.010630 0.610 0.652
## 2051 1300 1 0.630 0.010633 0.610 0.651
## 2053 1299 1 0.630 0.010636 0.609 0.651
## 2077 1298 1 0.629 0.010639 0.609 0.651
## 2099 1297 1 0.629 0.010642 0.608 0.650
## 2140 1296 1 0.628 0.010645 0.608 0.650
## 2141 1295 1 0.628 0.010648 0.607 0.649
## 2188 1294 1 0.627 0.010650 0.607 0.649
## 2190 1293 1 0.627 0.010653 0.606 0.648
## 2192 1292 1 0.626 0.010656 0.606 0.648
## 2333 1291 1 0.626 0.010659 0.605 0.647
## 2350 1290 1 0.625 0.010661 0.605 0.647
## 2408 1289 1 0.625 0.010664 0.604 0.646
plot(ICU.fit, main = 'Kaplan-Meier estimate of survival function', xlab = 'Length of survival (in days)')
# plotting Nelson-Aalen estimate (non-parametric)
plot(ICU.fit, fun="cumhaz", main = "Nelson-Aalen estimate of cumulative hazard function", xlab = 'Length of survival (in days)')
There were 773 deaths (out of 2061 participants) during follow-up.The median follow-up time cannot be determined as the survival rate has not yet dropped to 50% survival at the end of the available data. The cumulative hazard rate (as shown in the Nelson Aalen plot) reaches 47% by the end of the available data.
# Display frequencies for categorical explanatory variables
table(icu_patients_df1$Gender)
##
## Female Male
## 913 1148
table(icu_patients_df1$ICUType)
##
## Coronary Care Unit Cardiac Surgery Recovery Unit
## 297 448
## Medical ICU Surgical ICU
## 788 528
# Display counts, histograms, median and IQRs for continuous explanatory variables
#################################################################################
### CODE COPIED TO TASK 1
# Create PFratio variable:
# icu_patients_df1$PFratio<-icu_patients_df1$PaO2_min/icu_patients_df1$FiO2_max
### CODE COPIED TO TASK 1
#################################################################################
# Write a function for continuous variable EDA output
cont_eda <- function(variable){
print(paste(variable,'EDA:'))
na_rm <- na.omit(icu_patients_df1[,variable])
print(paste('Number of non-missing values:',length(na_rm))) # number of non-missing values
print(paste('Number of missing values:',sum(is.na(icu_patients_df1[,variable])))) # number of missing values
print(quantile(icu_patients_df1[,variable], na.rm=TRUE))
hist(icu_patients_df1[,variable], breaks=20, xlab=variable, main=paste('Histogram of',variable))
}
#################################################################################
### CODE COPIED TO TASK 1
# Loop through the continuous variables from the chosen list of variables to explore and pass them to the EDA function
# cont_vars <- c('Age', 'Height', 'Weight_max', 'Albumin_min', 'Bilirubin_max',
# 'BUN_max', 'Creatinine_max', 'GCS_min', 'Glucose_min',
# 'Glucose_max', 'HCO3_min', 'HR_min', 'HR_max', 'K_min', 'K_max',
# 'Lactate_max', 'MAP_min', 'Na_min', 'Na_max', 'NISysABP_min',
# 'NISysABP_max', 'Platelets_min', 'PFratio', 'pH_min', 'pH_max',
# 'RespRate_min', 'RespRate_max', 'Temp_min', 'Temp_max',
# 'TroponinI_max', 'TroponinT_max', 'Urine_min', 'WBC_min', 'WBC_max')
### CODE COPIED TO TASK 1
#################################################################################
par(mfrow=c(12,3)) # set the layout of the histograms in 12 row x 3 column grid
for(i in 1:length(cont_vars)){
cont_eda(cont_vars[i])
}
## [1] "Age EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 16 52 67 78 90
## [1] "Height EDA:"
## [1] "Number of non-missing values: 1069"
## [1] "Number of missing values: 992"
## 0% 25% 50% 75% 100%
## 13.0 162.6 170.2 177.8 426.7
## [1] "Weight_max EDA:"
## [1] "Number of non-missing values: 1915"
## [1] "Number of missing values: 146"
## 0% 25% 50% 75% 100%
## 34.60 66.00 80.00 94.55 230.00
## [1] "Albumin_min EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 1.1 2.6 3.0 3.5 5.3
## [1] "Bilirubin_max EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 0.1 0.4 0.7 1.3 45.9
## [1] "BUN_max EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 3 14 20 33 197
## [1] "Creatinine_max EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 0.2 0.8 1.0 1.5 22.0
## [1] "GCS_min EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 3 3 8 14 15
## [1] "Glucose_min EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 24 98 117 141 632
## [1] "Glucose_max EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 39 117 141 180 1143
## [1] "HCO3_min EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 5 20 23 25 44
## [1] "HR_min EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 0 61 71 81 126
## [1] "HR_max EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 44 91 104 119 300
## [1] "K_min EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 1.8 3.5 3.9 4.3 6.9
## [1] "K_max EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 2.5 4.0 4.3 4.7 22.9
## [1] "Lactate_max EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 0.4 1.5 2.2 3.2 29.3
## [1] "MAP_min EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 1 55 61 70 265
## [1] "Na_min EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 98 136 138 141 160
## [1] "Na_max EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 112 137 140 142 177
## [1] "NISysABP_min EDA:"
## [1] "Number of non-missing values: 1608"
## [1] "Number of missing values: 453"
## 0% 25% 50% 75% 100%
## 4 83 95 108 234
## [1] "NISysABP_max EDA:"
## [1] "Number of non-missing values: 1608"
## [1] "Number of missing values: 453"
## 0% 25% 50% 75% 100%
## 78 121 138 156 274
## [1] "Platelets_min EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 9 126 184 246 891
## [1] "PFratio EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 24 85 122 188 1150
## [1] "pH_min EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 3.00 7.28 7.34 7.39 7.63
## [1] "pH_max EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 7.15 7.38 7.42 7.46 7.69
## [1] "RespRate_min EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 4 12 14 17 24
## [1] "RespRate_max EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 13 24 27 33 98
## [1] "Temp_min EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 24.2 35.6 36.1 36.6 38.3
## [1] "Temp_max EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 35.4 37.1 37.6 38.2 42.1
## [1] "TroponinI_max EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 0.3 2.6 7.8 17.6 43.4
## [1] "TroponinT_max EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 0.01 0.06 0.17 0.80 24.46
## [1] "Urine_min EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 0 0 20 36 600
## [1] "WBC_min EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 0.1 7.6 10.4 14.1 128.3
## [1] "WBC_max EDA:"
## [1] "Number of non-missing values: 2061"
## [1] "Number of missing values: 0"
## 0% 25% 50% 75% 100%
## 0.1 9.3 12.3 16.9 155.6
*** needs to be updated: ***
** EDA Findings
… fill out the rest….
#Plot the Kaplan-Meier survival curves by all categorical variables in the data
#Gender
ICU.gender.fit <- survfit( Surv(Days, Status) ~ as.factor(Gender), data = icu_patients_df1)
print(ICU.gender.fit, print.rmean = TRUE)
## Call: survfit(formula = Surv(Days, Status) ~ as.factor(Gender), data = icu_patients_df1)
##
## n events *rmean *se(rmean) median 0.95LCL 0.95UCL
## as.factor(Gender)=Female 913 364 1588 35.2 NA NA NA
## as.factor(Gender)=Male 1148 409 1670 30.6 NA NA NA
## * restricted mean with upper limit = 2408
plot(ICU.gender.fit, col=c("blue", "red"), main = 'Kaplan-Meier estimate of survival function', xlab = 'Length of survival (in days)')
legend("bottomleft", legend=c("Female", "Male"),col=c("blue","red"), lty=1:1,cex=1)
#ICUType
ICU.type.fit <- survfit( Surv(Days, Status) ~ as.factor(ICUType), data = icu_patients_df1)
print(ICU.type.fit, print.rmean = TRUE)
## Call: survfit(formula = Surv(Days, Status) ~ as.factor(ICUType), data = icu_patients_df1)
##
## n events *rmean *se(rmean)
## as.factor(ICUType)=Coronary Care Unit 297 132 1486 63.1
## as.factor(ICUType)=Cardiac Surgery Recovery Unit 448 99 2002 38.9
## as.factor(ICUType)=Medical ICU 788 372 1414 39.3
## as.factor(ICUType)=Surgical ICU 528 170 1731 44.3
## median 0.95LCL 0.95UCL
## as.factor(ICUType)=Coronary Care Unit NA NA NA
## as.factor(ICUType)=Cardiac Surgery Recovery Unit NA NA NA
## as.factor(ICUType)=Medical ICU NA 2051 NA
## as.factor(ICUType)=Surgical ICU NA NA NA
## * restricted mean with upper limit = 2408
plot(ICU.type.fit, col=c("blue", "red","purple","green"), main = 'Kaplan-Meier estimate of survival function', xlab = 'Length of survival (in days)')
legend("bottomleft", legend=c("Coronary Care Unit", "Cardiac Surgery Recovery Unit", "Medical ICU", "Surgical ICU"),col=c("blue","red","purple","green"), lty=1:1,cex=1)
Risk of mortality is different by both Gender and ICU Type - the hazard rates also look proportional.
# Cox proportional models and Log Rank tests for the chosen variables
# Survival object = Surv(Days, Status)
# Gender
ICU.fitbyGender <- coxph( Surv(Days, Status) ~ as.factor(Gender), data = icu_patients_df1)
summary(ICU.fitbyGender)
## Call:
## coxph(formula = Surv(Days, Status) ~ as.factor(Gender), data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## as.factor(Gender)Male -0.13708 0.87190 0.07206 -1.902 0.0571 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## as.factor(Gender)Male 0.8719 1.147 0.7571 1.004
##
## Concordance= 0.516 (se = 0.009 )
## Likelihood ratio test= 3.61 on 1 df, p=0.06
## Wald test = 3.62 on 1 df, p=0.06
## Score (logrank) test = 3.62 on 1 df, p=0.06
# ICU Type
ICU.fitbytype <- coxph( Surv(Days, Status) ~ as.factor(ICUType), data = icu_patients_df1)
summary(ICU.fitbytype)
## Call:
## coxph(formula = Surv(Days, Status) ~ as.factor(ICUType), data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef)
## as.factor(ICUType)Cardiac Surgery Recovery Unit -0.87895 0.41522 0.13301
## as.factor(ICUType)Medical ICU 0.09362 1.09815 0.10131
## as.factor(ICUType)Surgical ICU -0.39843 0.67137 0.11603
## z Pr(>|z|)
## as.factor(ICUType)Cardiac Surgery Recovery Unit -6.608 0.0000000000389 ***
## as.factor(ICUType)Medical ICU 0.924 0.355437
## as.factor(ICUType)Surgical ICU -3.434 0.000595 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95
## as.factor(ICUType)Cardiac Surgery Recovery Unit 0.4152 2.4084 0.3199
## as.factor(ICUType)Medical ICU 1.0981 0.9106 0.9004
## as.factor(ICUType)Surgical ICU 0.6714 1.4895 0.5348
## upper .95
## as.factor(ICUType)Cardiac Surgery Recovery Unit 0.5389
## as.factor(ICUType)Medical ICU 1.3394
## as.factor(ICUType)Surgical ICU 0.8428
##
## Concordance= 0.597 (se = 0.009 )
## Likelihood ratio test= 98.74 on 3 df, p=<0.0000000000000002
## Wald test = 87.96 on 3 df, p=<0.0000000000000002
## Score (logrank) test = 93.02 on 3 df, p=<0.0000000000000002
# Age
ICU.fitbyage <- coxph( Surv(Days, Status) ~ Age, data = icu_patients_df1)
summary(ICU.fitbyage)
## Call:
## coxph(formula = Surv(Days, Status) ~ Age, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## Age 0.03355 1.03412 0.00250 13.42 <0.0000000000000002 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## Age 1.034 0.967 1.029 1.039
##
## Concordance= 0.646 (se = 0.01 )
## Likelihood ratio test= 209.4 on 1 df, p=<0.0000000000000002
## Wald test = 180.1 on 1 df, p=<0.0000000000000002
## Score (logrank) test = 187 on 1 df, p=<0.0000000000000002
# Height
ICU.fitbyheight <- coxph( Surv(Days, Status) ~ Height, data = icu_patients_df1)
summary(ICU.fitbyheight)
## Call:
## coxph(formula = Surv(Days, Status) ~ Height, data = icu_patients_df1)
##
## n= 1069, number of events= 385
## (992 observations deleted due to missingness)
##
## coef exp(coef) se(coef) z Pr(>|z|)
## Height -0.003851 0.996156 0.002346 -1.642 0.101
##
## exp(coef) exp(-coef) lower .95 upper .95
## Height 0.9962 1.004 0.9916 1.001
##
## Concordance= 0.541 (se = 0.015 )
## Likelihood ratio test= 2.7 on 1 df, p=0.1
## Wald test = 2.69 on 1 df, p=0.1
## Score (logrank) test = 2.52 on 1 df, p=0.1
# Weight_max
ICU.fitbyweightmax <- coxph( Surv(Days, Status) ~ Weight_max, data = icu_patients_df1)
summary(ICU.fitbyweightmax)
## Call:
## coxph(formula = Surv(Days, Status) ~ Weight_max, data = icu_patients_df1)
##
## n= 1915, number of events= 721
## (146 observations deleted due to missingness)
##
## coef exp(coef) se(coef) z Pr(>|z|)
## Weight_max -0.007213 0.992813 0.001759 -4.101 0.0000411 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## Weight_max 0.9928 1.007 0.9894 0.9962
##
## Concordance= 0.56 (se = 0.011 )
## Likelihood ratio test= 17.9 on 1 df, p=0.00002
## Wald test = 16.82 on 1 df, p=0.00004
## Score (logrank) test = 16.71 on 1 df, p=0.00004
# Albumin_min
ICU.fitbyAlbuminmin <- coxph( Surv(Days, Status) ~ Albumin_min, data = icu_patients_df1)
summary(ICU.fitbyAlbuminmin)
## Call:
## coxph(formula = Surv(Days, Status) ~ Albumin_min, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## Albumin_min -0.22075 0.80192 0.05704 -3.87 0.000109 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## Albumin_min 0.8019 1.247 0.7171 0.8968
##
## Concordance= 0.54 (se = 0.011 )
## Likelihood ratio test= 15.02 on 1 df, p=0.0001
## Wald test = 14.98 on 1 df, p=0.0001
## Score (logrank) test = 14.99 on 1 df, p=0.0001
# Bilirubin_max
ICU.fitbyBilirubinmax <- coxph( Surv(Days, Status) ~ Bilirubin_max, data = icu_patients_df1)
summary(ICU.fitbyBilirubinmax)
## Call:
## coxph(formula = Surv(Days, Status) ~ Bilirubin_max, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## Bilirubin_max 0.025159 1.025478 0.007431 3.386 0.00071 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## Bilirubin_max 1.025 0.9752 1.011 1.041
##
## Concordance= 0.515 (se = 0.011 )
## Likelihood ratio test= 9.48 on 1 df, p=0.002
## Wald test = 11.46 on 1 df, p=0.0007
## Score (logrank) test = 11.7 on 1 df, p=0.0006
# BUN_max
ICU.fitbyBUNmax <- coxph( Surv(Days, Status) ~ BUN_max, data = icu_patients_df1)
summary(ICU.fitbyBUNmax)
## Call:
## coxph(formula = Surv(Days, Status) ~ BUN_max, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## BUN_max 0.015002 1.015115 0.001064 14.09 <0.0000000000000002 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## BUN_max 1.015 0.9851 1.013 1.017
##
## Concordance= 0.647 (se = 0.01 )
## Likelihood ratio test= 142.5 on 1 df, p=<0.0000000000000002
## Wald test = 198.6 on 1 df, p=<0.0000000000000002
## Score (logrank) test = 207 on 1 df, p=<0.0000000000000002
# Creatinine_max
ICU.fitbyCreatininemax <- coxph( Surv(Days, Status) ~ Creatinine_max, data = icu_patients_df1)
summary(ICU.fitbyCreatininemax)
## Call:
## coxph(formula = Surv(Days, Status) ~ Creatinine_max, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## Creatinine_max 0.10152 1.10685 0.01467 6.92 0.0000000000045 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## Creatinine_max 1.107 0.9035 1.075 1.139
##
## Concordance= 0.594 (se = 0.011 )
## Likelihood ratio test= 35.11 on 1 df, p=0.000000003
## Wald test = 47.89 on 1 df, p=0.000000000005
## Score (logrank) test = 48.54 on 1 df, p=0.000000000003
# GCS_min
ICU.fitbyGCSmin <- coxph( Surv(Days, Status) ~ GCS_min, data = icu_patients_df1)
summary(ICU.fitbyGCSmin)
## Call:
## coxph(formula = Surv(Days, Status) ~ GCS_min, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## GCS_min 0.006052 1.006070 0.007324 0.826 0.409
##
## exp(coef) exp(-coef) lower .95 upper .95
## GCS_min 1.006 0.994 0.9917 1.021
##
## Concordance= 0.501 (se = 0.01 )
## Likelihood ratio test= 0.68 on 1 df, p=0.4
## Wald test = 0.68 on 1 df, p=0.4
## Score (logrank) test = 0.68 on 1 df, p=0.4
# Glucose - min & max
ICU.fitbyGlucosemin <- coxph( Surv(Days, Status) ~ Glucose_min, data = icu_patients_df1)
summary(ICU.fitbyGlucosemin)
## Call:
## coxph(formula = Surv(Days, Status) ~ Glucose_min, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## Glucose_min 0.0014076 1.0014086 0.0007477 1.883 0.0597 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## Glucose_min 1.001 0.9986 0.9999 1.003
##
## Concordance= 0.508 (se = 0.011 )
## Likelihood ratio test= 3.31 on 1 df, p=0.07
## Wald test = 3.54 on 1 df, p=0.06
## Score (logrank) test = 3.53 on 1 df, p=0.06
ICU.fitbyGlucosemax <- coxph( Surv(Days, Status) ~ Glucose_max, data = icu_patients_df1)
summary(ICU.fitbyGlucosemax)
## Call:
## coxph(formula = Surv(Days, Status) ~ Glucose_max, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## Glucose_max 0.0012981 1.0012989 0.0003245 4 0.0000634 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## Glucose_max 1.001 0.9987 1.001 1.002
##
## Concordance= 0.547 (se = 0.011 )
## Likelihood ratio test= 13.2 on 1 df, p=0.0003
## Wald test = 16 on 1 df, p=0.00006
## Score (logrank) test = 15.96 on 1 df, p=0.00006
# HCO3_min
ICU.fitbyHCO3min <- coxph( Surv(Days, Status) ~ HCO3_min, data = icu_patients_df1)
summary(ICU.fitbyHCO3min)
## Call:
## coxph(formula = Surv(Days, Status) ~ HCO3_min, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## HCO3_min -0.017036 0.983108 0.008023 -2.123 0.0337 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## HCO3_min 0.9831 1.017 0.9678 0.9987
##
## Concordance= 0.535 (se = 0.011 )
## Likelihood ratio test= 4.49 on 1 df, p=0.03
## Wald test = 4.51 on 1 df, p=0.03
## Score (logrank) test = 4.5 on 1 df, p=0.03
# HR - min & max
ICU.fitbyHRmin <- coxph( Surv(Days, Status) ~ HR_min, data = icu_patients_df1)
summary(ICU.fitbyHRmin)
## Call:
## coxph(formula = Surv(Days, Status) ~ HR_min, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## HR_min -0.0009841 0.9990164 0.0024165 -0.407 0.684
##
## exp(coef) exp(-coef) lower .95 upper .95
## HR_min 0.999 1.001 0.9943 1.004
##
## Concordance= 0.498 (se = 0.011 )
## Likelihood ratio test= 0.17 on 1 df, p=0.7
## Wald test = 0.17 on 1 df, p=0.7
## Score (logrank) test = 0.17 on 1 df, p=0.7
ICU.fitbyHRmax <- coxph( Surv(Days, Status) ~ HR_max, data = icu_patients_df1)
summary(ICU.fitbyHRmax)
## Call:
## coxph(formula = Surv(Days, Status) ~ HR_max, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## HR_max 0.002779 1.002783 0.001648 1.687 0.0916 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## HR_max 1.003 0.9972 0.9996 1.006
##
## Concordance= 0.515 (se = 0.011 )
## Likelihood ratio test= 2.79 on 1 df, p=0.09
## Wald test = 2.85 on 1 df, p=0.09
## Score (logrank) test = 2.84 on 1 df, p=0.09
# K - min & max
ICU.fitbyKmin <- coxph( Surv(Days, Status) ~ K_min, data = icu_patients_df1)
summary(ICU.fitbyKmin)
## Call:
## coxph(formula = Surv(Days, Status) ~ K_min, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## K_min 0.03906 1.03983 0.06125 0.638 0.524
##
## exp(coef) exp(-coef) lower .95 upper .95
## K_min 1.04 0.9617 0.9222 1.172
##
## Concordance= 0.502 (se = 0.011 )
## Likelihood ratio test= 0.41 on 1 df, p=0.5
## Wald test = 0.41 on 1 df, p=0.5
## Score (logrank) test = 0.41 on 1 df, p=0.5
ICU.fitbyKmax <- coxph( Surv(Days, Status) ~ K_max, data = icu_patients_df1)
summary(ICU.fitbyKmax)
## Call:
## coxph(formula = Surv(Days, Status) ~ K_max, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## K_max 0.07306 1.07579 0.02958 2.469 0.0135 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## K_max 1.076 0.9295 1.015 1.14
##
## Concordance= 0.527 (se = 0.011 )
## Likelihood ratio test= 4.81 on 1 df, p=0.03
## Wald test = 6.1 on 1 df, p=0.01
## Score (logrank) test = 5.98 on 1 df, p=0.01
# Lactate_max
ICU.fitbyLactatemax <- coxph( Surv(Days, Status) ~ Lactate_max, data = icu_patients_df1)
summary(ICU.fitbyLactatemax)
## Call:
## coxph(formula = Surv(Days, Status) ~ Lactate_max, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## Lactate_max 0.05778 1.05948 0.01666 3.467 0.000526 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## Lactate_max 1.059 0.9439 1.025 1.095
##
## Concordance= 0.508 (se = 0.011 )
## Likelihood ratio test= 10.95 on 1 df, p=0.0009
## Wald test = 12.02 on 1 df, p=0.0005
## Score (logrank) test = 12.03 on 1 df, p=0.0005
# MAP_min
ICU.fitbyMAPmin <- coxph( Surv(Days, Status) ~ MAP_min, data = icu_patients_df1)
summary(ICU.fitbyMAPmin)
## Call:
## coxph(formula = Surv(Days, Status) ~ MAP_min, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## MAP_min -0.004744 0.995267 0.002326 -2.04 0.0414 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## MAP_min 0.9953 1.005 0.9907 0.9998
##
## Concordance= 0.52 (se = 0.01 )
## Likelihood ratio test= 4.37 on 1 df, p=0.04
## Wald test = 4.16 on 1 df, p=0.04
## Score (logrank) test = 4.07 on 1 df, p=0.04
# Na - min & max
ICU.fitbyNamin <- coxph( Surv(Days, Status) ~ Na_min, data = icu_patients_df1)
summary(ICU.fitbyNamin)
## Call:
## coxph(formula = Surv(Days, Status) ~ Na_min, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## Na_min -0.021187 0.979036 0.007371 -2.875 0.00405 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## Na_min 0.979 1.021 0.965 0.9933
##
## Concordance= 0.536 (se = 0.011 )
## Likelihood ratio test= 7.74 on 1 df, p=0.005
## Wald test = 8.26 on 1 df, p=0.004
## Score (logrank) test = 8.16 on 1 df, p=0.004
ICU.fitbyNamax <- coxph( Surv(Days, Status) ~ Na_max, data = icu_patients_df1)
summary(ICU.fitbyNamax)
## Call:
## coxph(formula = Surv(Days, Status) ~ Na_max, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## Na_max -0.015698 0.984424 0.008287 -1.894 0.0582 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## Na_max 0.9844 1.016 0.9686 1.001
##
## Concordance= 0.521 (se = 0.011 )
## Likelihood ratio test= 3.61 on 1 df, p=0.06
## Wald test = 3.59 on 1 df, p=0.06
## Score (logrank) test = 3.57 on 1 df, p=0.06
# NISysABP - min & max
ICU.fitbyNISysABPmin <- coxph( Surv(Days, Status) ~ NISysABP_min, data = icu_patients_df1)
summary(ICU.fitbyNISysABPmin)
## Call:
## coxph(formula = Surv(Days, Status) ~ NISysABP_min, data = icu_patients_df1)
##
## n= 1608, number of events= 651
## (453 observations deleted due to missingness)
##
## coef exp(coef) se(coef) z Pr(>|z|)
## NISysABP_min -0.007374 0.992653 0.001994 -3.699 0.000216 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## NISysABP_min 0.9927 1.007 0.9888 0.9965
##
## Concordance= 0.555 (se = 0.012 )
## Likelihood ratio test= 14 on 1 df, p=0.0002
## Wald test = 13.68 on 1 df, p=0.0002
## Score (logrank) test = 13.54 on 1 df, p=0.0002
ICU.fitbyNISysABPmax <- coxph( Surv(Days, Status) ~ NISysABP_max, data = icu_patients_df1)
summary(ICU.fitbyNISysABPmax)
## Call:
## coxph(formula = Surv(Days, Status) ~ NISysABP_max, data = icu_patients_df1)
##
## n= 1608, number of events= 651
## (453 observations deleted due to missingness)
##
## coef exp(coef) se(coef) z Pr(>|z|)
## NISysABP_max 0.003503 1.003509 0.001402 2.498 0.0125 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## NISysABP_max 1.004 0.9965 1.001 1.006
##
## Concordance= 0.523 (se = 0.012 )
## Likelihood ratio test= 6.12 on 1 df, p=0.01
## Wald test = 6.24 on 1 df, p=0.01
## Score (logrank) test = 6.24 on 1 df, p=0.01
# Platelets_min
ICU.fitbyPlateletsmin <- coxph( Surv(Days, Status) ~ Platelets_min, data = icu_patients_df1)
summary(ICU.fitbyPlateletsmin)
## Call:
## coxph(formula = Surv(Days, Status) ~ Platelets_min, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## Platelets_min 0.0001735 1.0001735 0.0003440 0.504 0.614
##
## exp(coef) exp(-coef) lower .95 upper .95
## Platelets_min 1 0.9998 0.9995 1.001
##
## Concordance= 0.499 (se = 0.011 )
## Likelihood ratio test= 0.25 on 1 df, p=0.6
## Wald test = 0.25 on 1 df, p=0.6
## Score (logrank) test = 0.25 on 1 df, p=0.6
# PFratio (PaO2_min/FiO2_max)
ICU.fitbyPFratio <- coxph( Surv(Days, Status) ~ PFratio, data = icu_patients_df1)
summary(ICU.fitbyPFratio)
## Call:
## coxph(formula = Surv(Days, Status) ~ PFratio, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## PFratio -0.0002469 0.9997531 0.0003579 -0.69 0.49
##
## exp(coef) exp(-coef) lower .95 upper .95
## PFratio 0.9998 1 0.9991 1
##
## Concordance= 0.513 (se = 0.011 )
## Likelihood ratio test= 0.49 on 1 df, p=0.5
## Wald test = 0.48 on 1 df, p=0.5
## Score (logrank) test = 0.48 on 1 df, p=0.5
# pH - min & max
ICU.fitbypHmin <- coxph( Surv(Days, Status) ~ pH_min, data = icu_patients_df1)
summary(ICU.fitbypHmin)
## Call:
## coxph(formula = Surv(Days, Status) ~ pH_min, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## pH_min -0.6668 0.5133 0.1717 -3.884 0.000103 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## pH_min 0.5133 1.948 0.3667 0.7187
##
## Concordance= 0.51 (se = 0.011 )
## Likelihood ratio test= 8.34 on 1 df, p=0.004
## Wald test = 15.09 on 1 df, p=0.0001
## Score (logrank) test = 14.09 on 1 df, p=0.0002
ICU.fitbypHmax <- coxph( Surv(Days, Status) ~ pH_max, data = icu_patients_df1)
summary(ICU.fitbypHmax)
## Call:
## coxph(formula = Surv(Days, Status) ~ pH_max, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## pH_max -1.3288 0.2648 0.5512 -2.411 0.0159 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## pH_max 0.2648 3.776 0.0899 0.78
##
## Concordance= 0.524 (se = 0.011 )
## Likelihood ratio test= 5.78 on 1 df, p=0.02
## Wald test = 5.81 on 1 df, p=0.02
## Score (logrank) test = 5.81 on 1 df, p=0.02
# RespRate - min & max
ICU.fitbyRespRatemin <- coxph( Surv(Days, Status) ~ RespRate_min, data = icu_patients_df1)
summary(ICU.fitbyRespRatemin)
## Call:
## coxph(formula = Surv(Days, Status) ~ RespRate_min, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## RespRate_min 0.042945 1.043880 0.009451 4.544 0.00000552 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## RespRate_min 1.044 0.958 1.025 1.063
##
## Concordance= 0.555 (se = 0.01 )
## Likelihood ratio test= 20.44 on 1 df, p=0.000006
## Wald test = 20.65 on 1 df, p=0.000006
## Score (logrank) test = 20.67 on 1 df, p=0.000005
ICU.fitbyRespRatemax <- coxph( Surv(Days, Status) ~ RespRate_max, data = icu_patients_df1)
summary(ICU.fitbyRespRatemax)
## Call:
## coxph(formula = Surv(Days, Status) ~ RespRate_max, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## RespRate_max 0.01472 1.01483 0.00432 3.407 0.000657 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## RespRate_max 1.015 0.9854 1.006 1.023
##
## Concordance= 0.535 (se = 0.011 )
## Likelihood ratio test= 10.93 on 1 df, p=0.0009
## Wald test = 11.61 on 1 df, p=0.0007
## Score (logrank) test = 11.54 on 1 df, p=0.0007
# Temp - min & max
ICU.fitbyTempmin <- coxph( Surv(Days, Status) ~ Temp_min, data = icu_patients_df1)
summary(ICU.fitbyTempmin)
## Call:
## coxph(formula = Surv(Days, Status) ~ Temp_min, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## Temp_min -0.10541 0.89996 0.03894 -2.707 0.00679 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## Temp_min 0.9 1.111 0.8338 0.9713
##
## Concordance= 0.528 (se = 0.011 )
## Likelihood ratio test= 6.85 on 1 df, p=0.009
## Wald test = 7.33 on 1 df, p=0.007
## Score (logrank) test = 7.21 on 1 df, p=0.007
ICU.fitbyTempmax <- coxph( Surv(Days, Status) ~ Temp_max, data = icu_patients_df1)
summary(ICU.fitbyTempmax)
## Call:
## coxph(formula = Surv(Days, Status) ~ Temp_max, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## Temp_max -0.1966 0.8215 0.0493 -3.988 0.0000668 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## Temp_max 0.8215 1.217 0.7459 0.9049
##
## Concordance= 0.55 (se = 0.011 )
## Likelihood ratio test= 16.34 on 1 df, p=0.00005
## Wald test = 15.9 on 1 df, p=0.00007
## Score (logrank) test = 15.89 on 1 df, p=0.00007
# Troponin_max (I and T assays)
ICU.fitbyTroponinImax <- coxph( Surv(Days, Status) ~ TroponinI_max, data = icu_patients_df1)
summary(ICU.fitbyTroponinImax)
## Call:
## coxph(formula = Surv(Days, Status) ~ TroponinI_max, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## TroponinI_max -0.00000905 0.99999095 0.00324098 -0.003 0.998
##
## exp(coef) exp(-coef) lower .95 upper .95
## TroponinI_max 1 1 0.9937 1.006
##
## Concordance= 0.508 (se = 0.011 )
## Likelihood ratio test= 0 on 1 df, p=1
## Wald test = 0 on 1 df, p=1
## Score (logrank) test = 0 on 1 df, p=1
ICU.fitbyTroponinTmax <- coxph( Surv(Days, Status) ~ TroponinT_max, data = icu_patients_df1)
summary(ICU.fitbyTroponinTmax)
## Call:
## coxph(formula = Surv(Days, Status) ~ TroponinT_max, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## TroponinT_max 0.04152 1.04239 0.01583 2.623 0.00871 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## TroponinT_max 1.042 0.9593 1.011 1.075
##
## Concordance= 0.525 (se = 0.01 )
## Likelihood ratio test= 6 on 1 df, p=0.01
## Wald test = 6.88 on 1 df, p=0.009
## Score (logrank) test = 6.89 on 1 df, p=0.009
# Urine_min
ICU.fitbyUrinemin <- coxph( Surv(Days, Status) ~ Urine_min, data = icu_patients_df1)
summary(ICU.fitbyUrinemin)
## Call:
## coxph(formula = Surv(Days, Status) ~ Urine_min, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## Urine_min -0.0019252 0.9980767 0.0007179 -2.682 0.00733 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## Urine_min 0.9981 1.002 0.9967 0.9995
##
## Concordance= 0.525 (se = 0.01 )
## Likelihood ratio test= 8.51 on 1 df, p=0.004
## Wald test = 7.19 on 1 df, p=0.007
## Score (logrank) test = 7.23 on 1 df, p=0.007
# WBC - min & max
ICU.fitbyWBCmin <- coxph( Surv(Days, Status) ~ WBC_min, data = icu_patients_df1)
summary(ICU.fitbyWBCmin)
## Call:
## coxph(formula = Surv(Days, Status) ~ WBC_min, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## WBC_min 0.009102 1.009144 0.004755 1.914 0.0556 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## WBC_min 1.009 0.9909 0.9998 1.019
##
## Concordance= 0.501 (se = 0.011 )
## Likelihood ratio test= 3.18 on 1 df, p=0.07
## Wald test = 3.66 on 1 df, p=0.06
## Score (logrank) test = 3.59 on 1 df, p=0.06
ICU.fitbyWBCmax <- coxph( Surv(Days, Status) ~ WBC_max, data = icu_patients_df1)
summary(ICU.fitbyWBCmax)
## Call:
## coxph(formula = Surv(Days, Status) ~ WBC_max, data = icu_patients_df1)
##
## n= 2061, number of events= 773
##
## coef exp(coef) se(coef) z Pr(>|z|)
## WBC_max 0.003928 1.003936 0.004294 0.915 0.36
##
## exp(coef) exp(-coef) lower .95 upper .95
## WBC_max 1.004 0.9961 0.9955 1.012
##
## Concordance= 0.491 (se = 0.011 )
## Likelihood ratio test= 0.79 on 1 df, p=0.4
## Wald test = 0.84 on 1 df, p=0.4
## Score (logrank) test = 0.83 on 1 df, p=0.4
Univariable Cox model interpretation by Variable * Gender - non-significant log-rank test (p-value = 0.06), means that the null hypothesis of no difference in survival between genders is not rejected with a conclusion that survival does not significantly differ by gender. * ICUType - significant log-rank test (p-value close to 0), means that the null hypothesis is rejected with a conclusion that survival significantly differs by each ICU Type. Note that, hazard rate for those in Medical ICU is not statistically significantly different for those in Coronary Care Unit. * Length_of_stay - significant log-rank test (p-value close to 0), means that the null hypothesis is rejected with a conclusion that survival significantly differs by length of stay in hospital.For every additional day in hospital, the risk of mortality increases by approximately 1%. * Age - significant log-rank test (p-value close to 0), means that the null hypothesis is rejected with a conclusion that survival significantly differs by individual’s age. For every year older in age, the risk ofmortality increases by approcimately 3%. * Height - non-significant log-rank test (p-value = 0.1), means that the null hypothesis of no difference in survival for varying heights is not rejected with a conclusion that survival does not significantly differ by height. * Weight - the minimum, maximum and difference in weights as predictors result in significant log-rank tests indicating that the null hypothesis is rejected with a conclusion that survival significantly differs by weight. For every additional kilogram, the risk of mortality reduces by approximately 0.5-1%. Perhaps the use of a centred variable may make it easier to interpret. * SAPS1 - significant log-rank test (p-value close to 0), means that the null hypothesis is rejected with a conclusion that survival significantly differs by SAPS1 score. For every additional SAPS1 score, the risk of mortality increases by approximately 7%. * SOFA - significant log-rank test (p-value close to 0), means that the null hypothesis is rejected with a conclusion that survival significantly differs by SOFA score. For every additional SOFA score, the risk of mortality increases by approximately 6%. * Significant clinical measures are: * Bilirubin * Creatinine * FiO2 - maximum and difference from mean are significant * GCS - maximum and difference from mean are significant * HCO3 - difference from mean is highly significant, maximum and mean also significant * HR - difference from mean is significant * K - maximum and difference from mean are significant * MAP - minimum and difference from mean are significant * Na - minimum and difference from mean are significant * NISysABP
* PaO2 * SysABP - maximum and difference from mean are significant * Temp * Urine * WBC - difference from mean is significant
Updated list of significant log-ranks (5 May): ICUType, Age, Weight_max, Albumin_min, Bilirubin_max, BUN_max, Creatinine_max, Glucose_max, HCO3_min, K_max, Lactate_max, MAP_min, Na_min, NISysABP_min, NISysABP_max, pH_min, pH_max, RespRate_min, RespRate_max, Temp_min, Temp_max, TroponinT_max, Urine_min ***
#################################################################################
### CODE COPIED TO TASK 1
## Create a dataset without missing or invalid data to use to build the model ##
## in order to remain consistent and allow comparisons between models to be made ##
# # Check counts of missing data in each variable
# for(i in 1:length(colnames(icu_patients_df1))){
# print(c(i,colnames(icu_patients_df1[i]), sum(is.na(icu_patients_df1[i]))))
# }
# ## Result: of the variables chosen to explore for the survival model, large amounts of missing data in:
# ## Height (992), NISysABP_min (453), NISysABP_max (453), Weight_max (146)
#
# ## Decision: include Weight_max; remove Height, NISysABP_min, NISysABP_max
#
#
# # Check counts of negative data (noted some -1 values) in each variable
# for(i in 1:length(colnames(icu_patients_df1))){
# print(c(i,colnames(icu_patients_df1[i]), sum(icu_patients_df1[i] < 0)))
# }
# ## Result: negative values in Length_of_stay and SOFA (not listed in initial choice of variables anyway)
# # Create a new dataset with the only non-missing data from list of initial variables chosen
# # (excluding those with very high missingness i.e. Height, NISysABP_min, NISysABP_max)
# nm_icu_model_df1 <- na.omit(subset(icu_patients_df1,
# select=c(Days, Status, # the survival object variables
# RecordID, # keep record id for reference if needed
# in_hospital_death, # for task 1
# Age, Gender, ICUType, Weight_max,
# Albumin_min, Bilirubin_max,
# BUN_max, Creatinine_max,
# GCS_max, Glucose_min, Glucose_max,
# HCO3_min, HR_min, HR_max, K_min,
# K_max, Lactate_max, MAP_min, Na_min,
# Na_max, Platelets_min, PFratio, pH_min,
# pH_max, RespRate_min, RespRate_max,
# Temp_min, Temp_max, TroponinT_max,
# TroponinI_max, Urine_min, WBC_min, WBC_max)))
### CODE COPIED TO TASK 1
#################################################################################
## Fitting multivariable models ##
# Create a function to calculate AIC
calc_aic <- function(model){
# AIC = 2*k-2*logL (where k=df and df=number of coefficients in the model)
AIC <- 2*length(model$coefficients)-2*model$loglik[2]
}
# Full model using all listed initial variables (excluding those with high missingness)
ICU.mv_full <- coxph(Surv(Days, Status) ~
Age + Gender + ICUType + Weight_max + Albumin_min + Bilirubin_max +
BUN_max + Creatinine_max + GCS_max + Glucose_min + Glucose_max +
HCO3_min + HR_min + HR_max + K_min + K_max + Lactate_max + MAP_min +
Na_min + Na_max + Platelets_min + PFratio + pH_min + pH_max +
RespRate_min + RespRate_max + Temp_min + Temp_max + TroponinT_max +
TroponinI_max + Urine_min + WBC_min + WBC_max,
data = nm_icu_model_df1)
summary(ICU.mv_full)
## Call:
## coxph(formula = Surv(Days, Status) ~ Age + Gender + ICUType +
## Weight_max + Albumin_min + Bilirubin_max + BUN_max + Creatinine_max +
## GCS_max + Glucose_min + Glucose_max + HCO3_min + HR_min +
## HR_max + K_min + K_max + Lactate_max + MAP_min + Na_min +
## Na_max + Platelets_min + PFratio + pH_min + pH_max + RespRate_min +
## RespRate_max + Temp_min + Temp_max + TroponinT_max + TroponinI_max +
## Urine_min + WBC_min + WBC_max, data = nm_icu_model_df1)
##
## n= 1915, number of events= 721
##
## coef exp(coef) se(coef) z
## Age 0.03317420 1.03373060 0.00293981 11.284
## GenderMale -0.02592987 0.97440342 0.08213299 -0.316
## ICUTypeCardiac Surgery Recovery Unit -0.77268237 0.46177276 0.16528997 -4.675
## ICUTypeMedical ICU 0.31563031 1.37112327 0.11800531 2.675
## ICUTypeSurgical ICU -0.02301483 0.97724799 0.13801760 -0.167
## Weight_max -0.00243670 0.99756627 0.00193453 -1.260
## Albumin_min -0.11881877 0.88796872 0.06628328 -1.793
## Bilirubin_max 0.01439740 1.01450154 0.00797465 1.805
## BUN_max 0.01130860 1.01137279 0.00201088 5.624
## Creatinine_max -0.01482676 0.98528261 0.02766417 -0.536
## GCS_max -0.10623594 0.89921246 0.01452209 -7.315
## Glucose_min -0.00023802 0.99976201 0.00094230 -0.253
## Glucose_max 0.00044814 1.00044824 0.00056329 0.796
## HCO3_min 0.01886028 1.01903926 0.00968401 1.948
## HR_min 0.00591389 1.00593141 0.00306191 1.931
## HR_max 0.00202173 1.00202378 0.00200232 1.010
## K_min 0.06929166 1.07174875 0.08175841 0.848
## K_max -0.03279543 0.96773651 0.04629908 -0.708
## Lactate_max 0.04373789 1.04470849 0.02026084 2.159
## MAP_min -0.00084711 0.99915325 0.00243055 -0.349
## Na_min -0.00760018 0.99242863 0.01840942 -0.413
## Na_max -0.03029393 0.97016034 0.01857343 -1.631
## Platelets_min -0.00033177 0.99966828 0.00042555 -0.780
## PFratio -0.00001688 0.99998312 0.00039515 -0.043
## pH_min -0.48286560 0.61701274 0.20067709 -2.406
## pH_max 0.40316049 1.49654705 0.67511086 0.597
## RespRate_min -0.01676745 0.98337235 0.01305267 -1.285
## RespRate_max 0.00762531 1.00765446 0.00620645 1.229
## Temp_min -0.04991242 0.95131273 0.04838417 -1.032
## Temp_max -0.13691486 0.87204447 0.05738362 -2.386
## TroponinT_max 0.01708332 1.01723007 0.01829875 0.934
## TroponinI_max 0.00253724 1.00254046 0.00399639 0.635
## Urine_min -0.00197615 0.99802581 0.00096945 -2.038
## WBC_min 0.02549144 1.02581913 0.01460170 1.746
## WBC_max -0.01991114 0.98028578 0.01203181 -1.655
## Pr(>|z|)
## Age < 0.0000000000000002 ***
## GenderMale 0.75223
## ICUTypeCardiac Surgery Recovery Unit 0.000002943718242 ***
## ICUTypeMedical ICU 0.00748 **
## ICUTypeSurgical ICU 0.86756
## Weight_max 0.20782
## Albumin_min 0.07304 .
## Bilirubin_max 0.07101 .
## BUN_max 0.000000018688704 ***
## Creatinine_max 0.59199
## GCS_max 0.000000000000256 ***
## Glucose_min 0.80058
## Glucose_max 0.42628
## HCO3_min 0.05147 .
## HR_min 0.05343 .
## HR_max 0.31264
## K_min 0.39671
## K_max 0.47873
## Lactate_max 0.03087 *
## MAP_min 0.72744
## Na_min 0.67972
## Na_max 0.10288
## Platelets_min 0.43561
## PFratio 0.96592
## pH_min 0.01612 *
## pH_max 0.55039
## RespRate_min 0.19893
## RespRate_max 0.21922
## Temp_min 0.30227
## Temp_max 0.01703 *
## TroponinT_max 0.35052
## TroponinI_max 0.52550
## Urine_min 0.04151 *
## WBC_min 0.08085 .
## WBC_max 0.09795 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## Age 1.0337 0.9674 1.0278 1.0397
## GenderMale 0.9744 1.0263 0.8295 1.1446
## ICUTypeCardiac Surgery Recovery Unit 0.4618 2.1656 0.3340 0.6384
## ICUTypeMedical ICU 1.3711 0.7293 1.0880 1.7279
## ICUTypeSurgical ICU 0.9772 1.0233 0.7456 1.2808
## Weight_max 0.9976 1.0024 0.9938 1.0014
## Albumin_min 0.8880 1.1262 0.7798 1.0112
## Bilirubin_max 1.0145 0.9857 0.9988 1.0305
## BUN_max 1.0114 0.9888 1.0074 1.0154
## Creatinine_max 0.9853 1.0149 0.9333 1.0402
## GCS_max 0.8992 1.1121 0.8740 0.9252
## Glucose_min 0.9998 1.0002 0.9979 1.0016
## Glucose_max 1.0004 0.9996 0.9993 1.0016
## HCO3_min 1.0190 0.9813 0.9999 1.0386
## HR_min 1.0059 0.9941 0.9999 1.0120
## HR_max 1.0020 0.9980 0.9981 1.0060
## K_min 1.0717 0.9331 0.9131 1.2580
## K_max 0.9677 1.0333 0.8838 1.0597
## Lactate_max 1.0447 0.9572 1.0040 1.0870
## MAP_min 0.9992 1.0008 0.9944 1.0039
## Na_min 0.9924 1.0076 0.9573 1.0289
## Na_max 0.9702 1.0308 0.9355 1.0061
## Platelets_min 0.9997 1.0003 0.9988 1.0005
## PFratio 1.0000 1.0000 0.9992 1.0008
## pH_min 0.6170 1.6207 0.4164 0.9143
## pH_max 1.4965 0.6682 0.3985 5.6201
## RespRate_min 0.9834 1.0169 0.9585 1.0089
## RespRate_max 1.0077 0.9924 0.9955 1.0200
## Temp_min 0.9513 1.0512 0.8652 1.0459
## Temp_max 0.8720 1.1467 0.7793 0.9759
## TroponinT_max 1.0172 0.9831 0.9814 1.0544
## TroponinI_max 1.0025 0.9975 0.9947 1.0104
## Urine_min 0.9980 1.0020 0.9961 0.9999
## WBC_min 1.0258 0.9748 0.9969 1.0556
## WBC_max 0.9803 1.0201 0.9574 1.0037
##
## Concordance= 0.743 (se = 0.009 )
## Likelihood ratio test= 518.5 on 35 df, p=<0.0000000000000002
## Wald test = 507.1 on 35 df, p=<0.0000000000000002
## Score (logrank) test = 556 on 35 df, p=<0.0000000000000002
# Calculate full model AIC
AIC.mv_full <- calc_aic(ICU.mv_full)
AIC.mv_full #10136
## [1] 10135.95
# 1st reduced model using all variables with significant log-rank tests
ICU.mv_reduced1 <- coxph(Surv(Days, Status) ~
Age + ICUType + Weight_max + Albumin_min + Bilirubin_max +
BUN_max + Creatinine_max + Glucose_max + HCO3_min +
K_max + Lactate_max + MAP_min + Na_min + pH_min +
pH_max + RespRate_min + RespRate_max + Temp_min +
Temp_max + TroponinT_max + Urine_min,
data = nm_icu_model_df1)
summary(ICU.mv_reduced1)
## Call:
## coxph(formula = Surv(Days, Status) ~ Age + ICUType + Weight_max +
## Albumin_min + Bilirubin_max + BUN_max + Creatinine_max +
## Glucose_max + HCO3_min + K_max + Lactate_max + MAP_min +
## Na_min + pH_min + pH_max + RespRate_min + RespRate_max +
## Temp_min + Temp_max + TroponinT_max + Urine_min, data = nm_icu_model_df1)
##
## n= 1915, number of events= 721
##
## coef exp(coef) se(coef) z
## Age 0.0312354 1.0317284 0.0028364 11.012
## ICUTypeCardiac Surgery Recovery Unit -0.6478864 0.5231503 0.1526726 -4.244
## ICUTypeMedical ICU 0.3901076 1.4771398 0.1174207 3.322
## ICUTypeSurgical ICU 0.0838899 1.0875091 0.1335289 0.628
## Weight_max -0.0021849 0.9978175 0.0018229 -1.199
## Albumin_min -0.1540079 0.8572653 0.0645077 -2.387
## Bilirubin_max 0.0144855 1.0145910 0.0081080 1.787
## BUN_max 0.0123140 1.0123901 0.0019382 6.353
## Creatinine_max -0.0294390 0.9709901 0.0265352 -1.109
## Glucose_max 0.0001531 1.0001531 0.0004043 0.379
## HCO3_min 0.0174705 1.0176240 0.0092255 1.894
## K_max -0.0253362 0.9749821 0.0363475 -0.697
## Lactate_max 0.0545008 1.0560134 0.0196475 2.774
## MAP_min -0.0012256 0.9987751 0.0023952 -0.512
## Na_min -0.0286393 0.9717669 0.0080801 -3.544
## pH_min -0.6275382 0.5339046 0.1968359 -3.188
## pH_max 0.8969219 2.4520437 0.6400444 1.401
## RespRate_min 0.0163537 1.0164882 0.0116422 1.405
## RespRate_max 0.0124759 1.0125540 0.0056445 2.210
## Temp_min -0.0426614 0.9582358 0.0474244 -0.900
## Temp_max -0.0829817 0.9203680 0.0557570 -1.488
## TroponinT_max 0.0168454 1.0169881 0.0175080 0.962
## Urine_min -0.0025723 0.9974311 0.0009526 -2.700
## Pr(>|z|)
## Age < 0.0000000000000002 ***
## ICUTypeCardiac Surgery Recovery Unit 0.000021992990 ***
## ICUTypeMedical ICU 0.000893 ***
## ICUTypeSurgical ICU 0.529838
## Weight_max 0.230687
## Albumin_min 0.016967 *
## Bilirubin_max 0.074005 .
## BUN_max 0.000000000211 ***
## Creatinine_max 0.267245
## Glucose_max 0.704875
## HCO3_min 0.058262 .
## K_max 0.485769
## Lactate_max 0.005538 **
## MAP_min 0.608865
## Na_min 0.000393 ***
## pH_min 0.001432 **
## pH_max 0.161112
## RespRate_min 0.160113
## RespRate_max 0.027086 *
## Temp_min 0.368351
## Temp_max 0.136678
## TroponinT_max 0.335972
## Urine_min 0.006927 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## Age 1.0317 0.9692 1.0260 1.0375
## ICUTypeCardiac Surgery Recovery Unit 0.5232 1.9115 0.3879 0.7056
## ICUTypeMedical ICU 1.4771 0.6770 1.1735 1.8594
## ICUTypeSurgical ICU 1.0875 0.9195 0.8371 1.4128
## Weight_max 0.9978 1.0022 0.9943 1.0014
## Albumin_min 0.8573 1.1665 0.7555 0.9728
## Bilirubin_max 1.0146 0.9856 0.9986 1.0308
## BUN_max 1.0124 0.9878 1.0086 1.0162
## Creatinine_max 0.9710 1.0299 0.9218 1.0228
## Glucose_max 1.0002 0.9998 0.9994 1.0009
## HCO3_min 1.0176 0.9827 0.9994 1.0362
## K_max 0.9750 1.0257 0.9079 1.0470
## Lactate_max 1.0560 0.9470 1.0161 1.0975
## MAP_min 0.9988 1.0012 0.9941 1.0035
## Na_min 0.9718 1.0291 0.9565 0.9873
## pH_min 0.5339 1.8730 0.3630 0.7853
## pH_max 2.4520 0.4078 0.6994 8.5968
## RespRate_min 1.0165 0.9838 0.9936 1.0399
## RespRate_max 1.0126 0.9876 1.0014 1.0238
## Temp_min 0.9582 1.0436 0.8732 1.0516
## Temp_max 0.9204 1.0865 0.8251 1.0266
## TroponinT_max 1.0170 0.9833 0.9827 1.0525
## Urine_min 0.9974 1.0026 0.9956 0.9993
##
## Concordance= 0.726 (se = 0.009 )
## Likelihood ratio test= 452.1 on 23 df, p=<0.0000000000000002
## Wald test = 439.8 on 23 df, p=<0.0000000000000002
## Score (logrank) test = 482.2 on 23 df, p=<0.0000000000000002
# Calculate 1st reduced model AIC
AIC.mv_reduced1 <- calc_aic(ICU.mv_reduced1)
AIC.mv_reduced1 #10178
## [1] 10178.32
# 2nd reduced model using all variables significant (using cut off p < 0.1) in ICU.mv_reduced1
# (note using p < 0.1 gained better results than p < 0.05 as a cut off)
ICU.mv_reduced2 <- coxph(Surv(Days, Status) ~
Age + ICUType + Albumin_min + Bilirubin_max + BUN_max +
HCO3_min + Lactate_max + Na_min + pH_min +
RespRate_max + Urine_min,
data = nm_icu_model_df1)
summary(ICU.mv_reduced2)
## Call:
## coxph(formula = Surv(Days, Status) ~ Age + ICUType + Albumin_min +
## Bilirubin_max + BUN_max + HCO3_min + Lactate_max + Na_min +
## pH_min + RespRate_max + Urine_min, data = nm_icu_model_df1)
##
## n= 1915, number of events= 721
##
## coef exp(coef) se(coef) z
## Age 0.0336951 1.0342693 0.0026779 12.583
## ICUTypeCardiac Surgery Recovery Unit -0.7052417 0.4939891 0.1428496 -4.937
## ICUTypeMedical ICU 0.3140214 1.3689190 0.1113657 2.820
## ICUTypeSurgical ICU 0.0067186 1.0067412 0.1273610 0.053
## Albumin_min -0.1529698 0.8581556 0.0634725 -2.410
## Bilirubin_max 0.0146272 1.0147347 0.0079423 1.842
## BUN_max 0.0106532 1.0107102 0.0014018 7.600
## HCO3_min 0.0173644 1.0175161 0.0087596 1.982
## Lactate_max 0.0628071 1.0648214 0.0182291 3.445
## Na_min -0.0252732 0.9750435 0.0073066 -3.459
## pH_min -0.6409326 0.5268009 0.1946101 -3.293
## RespRate_max 0.0143032 1.0144059 0.0047394 3.018
## Urine_min -0.0025693 0.9974340 0.0009383 -2.738
## Pr(>|z|)
## Age < 0.0000000000000002 ***
## ICUTypeCardiac Surgery Recovery Unit 0.0000007935243281 ***
## ICUTypeMedical ICU 0.004806 **
## ICUTypeSurgical ICU 0.957929
## Albumin_min 0.015952 *
## Bilirubin_max 0.065522 .
## BUN_max 0.0000000000000297 ***
## HCO3_min 0.047442 *
## Lactate_max 0.000570 ***
## Na_min 0.000542 ***
## pH_min 0.000990 ***
## RespRate_max 0.002545 **
## Urine_min 0.006177 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## Age 1.0343 0.9669 1.0289 1.0397
## ICUTypeCardiac Surgery Recovery Unit 0.4940 2.0243 0.3734 0.6536
## ICUTypeMedical ICU 1.3689 0.7305 1.1005 1.7028
## ICUTypeSurgical ICU 1.0067 0.9933 0.7843 1.2922
## Albumin_min 0.8582 1.1653 0.7578 0.9718
## Bilirubin_max 1.0147 0.9855 0.9991 1.0307
## BUN_max 1.0107 0.9894 1.0079 1.0135
## HCO3_min 1.0175 0.9828 1.0002 1.0351
## Lactate_max 1.0648 0.9391 1.0274 1.1036
## Na_min 0.9750 1.0256 0.9612 0.9891
## pH_min 0.5268 1.8983 0.3597 0.7714
## RespRate_max 1.0144 0.9858 1.0050 1.0239
## Urine_min 0.9974 1.0026 0.9956 0.9993
##
## Concordance= 0.724 (se = 0.009 )
## Likelihood ratio test= 439.1 on 13 df, p=<0.0000000000000002
## Wald test = 422.9 on 13 df, p=<0.0000000000000002
## Score (logrank) test = 457.6 on 13 df, p=<0.0000000000000002
# Calculate 2nd reduced model AIC
AIC.mv_reduced2 <- calc_aic(ICU.mv_reduced2)
AIC.mv_reduced2 #10171
## [1] 10171.34
# 3rd reduced model by using step() function on the full model (which had the lowest AIC so far)
ICU.mv_reduced3 <- step(ICU.mv_full, trace=1)
## Start: AIC=10135.95
## Surv(Days, Status) ~ Age + Gender + ICUType + Weight_max + Albumin_min +
## Bilirubin_max + BUN_max + Creatinine_max + GCS_max + Glucose_min +
## Glucose_max + HCO3_min + HR_min + HR_max + K_min + K_max +
## Lactate_max + MAP_min + Na_min + Na_max + Platelets_min +
## PFratio + pH_min + pH_max + RespRate_min + RespRate_max +
## Temp_min + Temp_max + TroponinT_max + TroponinI_max + Urine_min +
## WBC_min + WBC_max
##
## Df AIC
## - PFratio 1 10134
## - Glucose_min 1 10134
## - Gender 1 10134
## - MAP_min 1 10134
## - Na_min 1 10134
## - Creatinine_max 1 10134
## - pH_max 1 10134
## - TroponinI_max 1 10134
## - K_max 1 10134
## - Platelets_min 1 10135
## - Glucose_max 1 10135
## - K_min 1 10135
## - TroponinT_max 1 10135
## - HR_max 1 10135
## - Temp_min 1 10135
## - RespRate_max 1 10135
## - Weight_max 1 10136
## - RespRate_min 1 10136
## <none> 10136
## - Na_max 1 10137
## - WBC_max 1 10137
## - Bilirubin_max 1 10137
## - WBC_min 1 10137
## - Albumin_min 1 10137
## - HCO3_min 1 10138
## - HR_min 1 10138
## - pH_min 1 10138
## - Lactate_max 1 10138
## - Urine_min 1 10139
## - Temp_max 1 10140
## - BUN_max 1 10163
## - GCS_max 1 10186
## - ICUType 3 10191
## - Age 1 10276
##
## Step: AIC=10133.95
## Surv(Days, Status) ~ Age + Gender + ICUType + Weight_max + Albumin_min +
## Bilirubin_max + BUN_max + Creatinine_max + GCS_max + Glucose_min +
## Glucose_max + HCO3_min + HR_min + HR_max + K_min + K_max +
## Lactate_max + MAP_min + Na_min + Na_max + Platelets_min +
## pH_min + pH_max + RespRate_min + RespRate_max + Temp_min +
## Temp_max + TroponinT_max + TroponinI_max + Urine_min + WBC_min +
## WBC_max
##
## Df AIC
## - Glucose_min 1 10132
## - Gender 1 10132
## - MAP_min 1 10132
## - Na_min 1 10132
## - Creatinine_max 1 10132
## - pH_max 1 10132
## - TroponinI_max 1 10132
## - K_max 1 10132
## - Platelets_min 1 10133
## - Glucose_max 1 10133
## - K_min 1 10133
## - TroponinT_max 1 10133
## - HR_max 1 10133
## - Temp_min 1 10133
## - RespRate_max 1 10133
## - Weight_max 1 10134
## - RespRate_min 1 10134
## <none> 10134
## - Na_max 1 10135
## - WBC_max 1 10135
## - Bilirubin_max 1 10135
## - WBC_min 1 10135
## - Albumin_min 1 10135
## - HCO3_min 1 10136
## - HR_min 1 10136
## - pH_min 1 10136
## - Lactate_max 1 10136
## - Urine_min 1 10137
## - Temp_max 1 10138
## - BUN_max 1 10162
## - GCS_max 1 10184
## - ICUType 3 10189
## - Age 1 10275
##
## Step: AIC=10132.02
## Surv(Days, Status) ~ Age + Gender + ICUType + Weight_max + Albumin_min +
## Bilirubin_max + BUN_max + Creatinine_max + GCS_max + Glucose_max +
## HCO3_min + HR_min + HR_max + K_min + K_max + Lactate_max +
## MAP_min + Na_min + Na_max + Platelets_min + pH_min + pH_max +
## RespRate_min + RespRate_max + Temp_min + Temp_max + TroponinT_max +
## TroponinI_max + Urine_min + WBC_min + WBC_max
##
## Df AIC
## - Gender 1 10130
## - MAP_min 1 10130
## - Na_min 1 10130
## - Creatinine_max 1 10130
## - pH_max 1 10130
## - TroponinI_max 1 10130
## - K_max 1 10130
## - Platelets_min 1 10131
## - Glucose_max 1 10131
## - K_min 1 10131
## - TroponinT_max 1 10131
## - HR_max 1 10131
## - Temp_min 1 10131
## - RespRate_max 1 10132
## - Weight_max 1 10132
## - RespRate_min 1 10132
## <none> 10132
## - Na_max 1 10133
## - WBC_max 1 10133
## - Bilirubin_max 1 10133
## - WBC_min 1 10133
## - Albumin_min 1 10133
## - HCO3_min 1 10134
## - HR_min 1 10134
## - pH_min 1 10134
## - Lactate_max 1 10134
## - Urine_min 1 10135
## - Temp_max 1 10136
## - BUN_max 1 10160
## - GCS_max 1 10182
## - ICUType 3 10187
## - Age 1 10273
##
## Step: AIC=10130.11
## Surv(Days, Status) ~ Age + ICUType + Weight_max + Albumin_min +
## Bilirubin_max + BUN_max + Creatinine_max + GCS_max + Glucose_max +
## HCO3_min + HR_min + HR_max + K_min + K_max + Lactate_max +
## MAP_min + Na_min + Na_max + Platelets_min + pH_min + pH_max +
## RespRate_min + RespRate_max + Temp_min + Temp_max + TroponinT_max +
## TroponinI_max + Urine_min + WBC_min + WBC_max
##
## Df AIC
## - MAP_min 1 10128
## - Na_min 1 10128
## - Creatinine_max 1 10128
## - pH_max 1 10128
## - K_max 1 10129
## - TroponinI_max 1 10129
## - Platelets_min 1 10129
## - K_min 1 10129
## - Glucose_max 1 10129
## - TroponinT_max 1 10129
## - HR_max 1 10129
## - Temp_min 1 10129
## - RespRate_max 1 10130
## - RespRate_min 1 10130
## <none> 10130
## - Weight_max 1 10130
## - WBC_max 1 10131
## - Na_max 1 10131
## - Bilirubin_max 1 10131
## - WBC_min 1 10131
## - Albumin_min 1 10132
## - HCO3_min 1 10132
## - HR_min 1 10132
## - pH_min 1 10132
## - Lactate_max 1 10133
## - Urine_min 1 10133
## - Temp_max 1 10134
## - BUN_max 1 10158
## - GCS_max 1 10180
## - ICUType 3 10185
## - Age 1 10271
##
## Step: AIC=10128.23
## Surv(Days, Status) ~ Age + ICUType + Weight_max + Albumin_min +
## Bilirubin_max + BUN_max + Creatinine_max + GCS_max + Glucose_max +
## HCO3_min + HR_min + HR_max + K_min + K_max + Lactate_max +
## Na_min + Na_max + Platelets_min + pH_min + pH_max + RespRate_min +
## RespRate_max + Temp_min + Temp_max + TroponinT_max + TroponinI_max +
## Urine_min + WBC_min + WBC_max
##
## Df AIC
## - Na_min 1 10126
## - Creatinine_max 1 10126
## - pH_max 1 10127
## - K_max 1 10127
## - TroponinI_max 1 10127
## - Platelets_min 1 10127
## - K_min 1 10127
## - Glucose_max 1 10127
## - TroponinT_max 1 10127
## - HR_max 1 10127
## - Temp_min 1 10127
## - RespRate_max 1 10128
## - RespRate_min 1 10128
## - Weight_max 1 10128
## <none> 10128
## - WBC_max 1 10129
## - Na_max 1 10129
## - Bilirubin_max 1 10129
## - WBC_min 1 10129
## - Albumin_min 1 10130
## - HCO3_min 1 10130
## - HR_min 1 10130
## - pH_min 1 10130
## - Lactate_max 1 10131
## - Urine_min 1 10131
## - Temp_max 1 10132
## - BUN_max 1 10156
## - GCS_max 1 10179
## - ICUType 3 10184
## - Age 1 10271
##
## Step: AIC=10126.46
## Surv(Days, Status) ~ Age + ICUType + Weight_max + Albumin_min +
## Bilirubin_max + BUN_max + Creatinine_max + GCS_max + Glucose_max +
## HCO3_min + HR_min + HR_max + K_min + K_max + Lactate_max +
## Na_max + Platelets_min + pH_min + pH_max + RespRate_min +
## RespRate_max + Temp_min + Temp_max + TroponinT_max + TroponinI_max +
## Urine_min + WBC_min + WBC_max
##
## Df AIC
## - K_max 1 10125
## - Creatinine_max 1 10125
## - pH_max 1 10125
## - K_min 1 10125
## - Platelets_min 1 10125
## - TroponinI_max 1 10125
## - TroponinT_max 1 10125
## - HR_max 1 10125
## - Glucose_max 1 10125
## - Temp_min 1 10126
## - RespRate_max 1 10126
## - RespRate_min 1 10126
## - Weight_max 1 10126
## <none> 10126
## - WBC_max 1 10127
## - WBC_min 1 10127
## - Bilirubin_max 1 10128
## - Albumin_min 1 10128
## - HCO3_min 1 10128
## - HR_min 1 10128
## - pH_min 1 10129
## - Lactate_max 1 10129
## - Urine_min 1 10130
## - Temp_max 1 10130
## - Na_max 1 10145
## - BUN_max 1 10154
## - GCS_max 1 10177
## - ICUType 3 10183
## - Age 1 10269
##
## Step: AIC=10124.71
## Surv(Days, Status) ~ Age + ICUType + Weight_max + Albumin_min +
## Bilirubin_max + BUN_max + Creatinine_max + GCS_max + Glucose_max +
## HCO3_min + HR_min + HR_max + K_min + Lactate_max + Na_max +
## Platelets_min + pH_min + pH_max + RespRate_min + RespRate_max +
## Temp_min + Temp_max + TroponinT_max + TroponinI_max + Urine_min +
## WBC_min + WBC_max
##
## Df AIC
## - K_min 1 10123
## - Creatinine_max 1 10123
## - pH_max 1 10123
## - Platelets_min 1 10123
## - TroponinI_max 1 10123
## - Glucose_max 1 10124
## - TroponinT_max 1 10124
## - HR_max 1 10124
## - Temp_min 1 10124
## - RespRate_max 1 10124
## - RespRate_min 1 10124
## - Weight_max 1 10125
## <none> 10125
## - WBC_max 1 10125
## - WBC_min 1 10126
## - Bilirubin_max 1 10126
## - Albumin_min 1 10126
## - HCO3_min 1 10126
## - HR_min 1 10127
## - pH_min 1 10127
## - Lactate_max 1 10127
## - Urine_min 1 10128
## - Temp_max 1 10129
## - Na_max 1 10143
## - BUN_max 1 10152
## - GCS_max 1 10175
## - ICUType 3 10182
## - Age 1 10268
##
## Step: AIC=10123
## Surv(Days, Status) ~ Age + ICUType + Weight_max + Albumin_min +
## Bilirubin_max + BUN_max + Creatinine_max + GCS_max + Glucose_max +
## HCO3_min + HR_min + HR_max + Lactate_max + Na_max + Platelets_min +
## pH_min + pH_max + RespRate_min + RespRate_max + Temp_min +
## Temp_max + TroponinT_max + TroponinI_max + Urine_min + WBC_min +
## WBC_max
##
## Df AIC
## - Creatinine_max 1 10121
## - pH_max 1 10121
## - Platelets_min 1 10121
## - TroponinI_max 1 10122
## - Glucose_max 1 10122
## - TroponinT_max 1 10122
## - HR_max 1 10122
## - Temp_min 1 10122
## - RespRate_max 1 10122
## - Weight_max 1 10123
## - RespRate_min 1 10123
## <none> 10123
## - WBC_max 1 10124
## - Bilirubin_max 1 10124
## - WBC_min 1 10124
## - Albumin_min 1 10124
## - HCO3_min 1 10125
## - HR_min 1 10125
## - pH_min 1 10125
## - Lactate_max 1 10125
## - Urine_min 1 10126
## - Temp_max 1 10127
## - Na_max 1 10143
## - BUN_max 1 10152
## - GCS_max 1 10174
## - ICUType 3 10184
## - Age 1 10268
##
## Step: AIC=10121.29
## Surv(Days, Status) ~ Age + ICUType + Weight_max + Albumin_min +
## Bilirubin_max + BUN_max + GCS_max + Glucose_max + HCO3_min +
## HR_min + HR_max + Lactate_max + Na_max + Platelets_min +
## pH_min + pH_max + RespRate_min + RespRate_max + Temp_min +
## Temp_max + TroponinT_max + TroponinI_max + Urine_min + WBC_min +
## WBC_max
##
## Df AIC
## - pH_max 1 10120
## - Platelets_min 1 10120
## - TroponinI_max 1 10120
## - Glucose_max 1 10120
## - TroponinT_max 1 10120
## - HR_max 1 10120
## - Temp_min 1 10120
## - RespRate_max 1 10120
## - RespRate_min 1 10121
## - Weight_max 1 10121
## <none> 10121
## - Bilirubin_max 1 10122
## - WBC_max 1 10122
## - Albumin_min 1 10123
## - WBC_min 1 10123
## - HCO3_min 1 10123
## - HR_min 1 10123
## - pH_min 1 10124
## - Lactate_max 1 10124
## - Urine_min 1 10124
## - Temp_max 1 10125
## - Na_max 1 10141
## - BUN_max 1 10165
## - GCS_max 1 10173
## - ICUType 3 10182
## - Age 1 10272
##
## Step: AIC=10119.7
## Surv(Days, Status) ~ Age + ICUType + Weight_max + Albumin_min +
## Bilirubin_max + BUN_max + GCS_max + Glucose_max + HCO3_min +
## HR_min + HR_max + Lactate_max + Na_max + Platelets_min +
## pH_min + RespRate_min + RespRate_max + Temp_min + Temp_max +
## TroponinT_max + TroponinI_max + Urine_min + WBC_min + WBC_max
##
## Df AIC
## - TroponinI_max 1 10118
## - Platelets_min 1 10118
## - Glucose_max 1 10118
## - TroponinT_max 1 10119
## - HR_max 1 10119
## - Temp_min 1 10119
## - RespRate_max 1 10119
## <none> 10120
## - RespRate_min 1 10120
## - Weight_max 1 10120
## - Bilirubin_max 1 10121
## - WBC_max 1 10121
## - Albumin_min 1 10121
## - WBC_min 1 10121
## - HR_min 1 10122
## - pH_min 1 10122
## - Lactate_max 1 10122
## - HCO3_min 1 10122
## - Urine_min 1 10122
## - Temp_max 1 10123
## - Na_max 1 10140
## - BUN_max 1 10163
## - GCS_max 1 10174
## - ICUType 3 10182
## - Age 1 10270
##
## Step: AIC=10118.15
## Surv(Days, Status) ~ Age + ICUType + Weight_max + Albumin_min +
## Bilirubin_max + BUN_max + GCS_max + Glucose_max + HCO3_min +
## HR_min + HR_max + Lactate_max + Na_max + Platelets_min +
## pH_min + RespRate_min + RespRate_max + Temp_min + Temp_max +
## TroponinT_max + Urine_min + WBC_min + WBC_max
##
## Df AIC
## - Platelets_min 1 10117
## - Glucose_max 1 10117
## - TroponinT_max 1 10117
## - Temp_min 1 10117
## - HR_max 1 10118
## <none> 10118
## - RespRate_min 1 10118
## - Weight_max 1 10118
## - RespRate_max 1 10118
## - Bilirubin_max 1 10119
## - WBC_max 1 10119
## - WBC_min 1 10119
## - Albumin_min 1 10120
## - HR_min 1 10120
## - pH_min 1 10120
## - Lactate_max 1 10120
## - Urine_min 1 10121
## - HCO3_min 1 10121
## - Temp_max 1 10122
## - Na_max 1 10138
## - BUN_max 1 10166
## - GCS_max 1 10172
## - ICUType 3 10181
## - Age 1 10268
##
## Step: AIC=10116.63
## Surv(Days, Status) ~ Age + ICUType + Weight_max + Albumin_min +
## Bilirubin_max + BUN_max + GCS_max + Glucose_max + HCO3_min +
## HR_min + HR_max + Lactate_max + Na_max + pH_min + RespRate_min +
## RespRate_max + Temp_min + Temp_max + TroponinT_max + Urine_min +
## WBC_min + WBC_max
##
## Df AIC
## - Glucose_max 1 10116
## - TroponinT_max 1 10116
## - Temp_min 1 10116
## - HR_max 1 10116
## <none> 10117
## - Weight_max 1 10117
## - RespRate_min 1 10117
## - RespRate_max 1 10117
## - WBC_min 1 10118
## - WBC_max 1 10118
## - Bilirubin_max 1 10118
## - HR_min 1 10118
## - Albumin_min 1 10118
## - pH_min 1 10119
## - Lactate_max 1 10119
## - Urine_min 1 10119
## - HCO3_min 1 10120
## - Temp_max 1 10120
## - Na_max 1 10136
## - BUN_max 1 10165
## - GCS_max 1 10171
## - ICUType 3 10180
## - Age 1 10268
##
## Step: AIC=10115.63
## Surv(Days, Status) ~ Age + ICUType + Weight_max + Albumin_min +
## Bilirubin_max + BUN_max + GCS_max + HCO3_min + HR_min + HR_max +
## Lactate_max + Na_max + pH_min + RespRate_min + RespRate_max +
## Temp_min + Temp_max + TroponinT_max + Urine_min + WBC_min +
## WBC_max
##
## Df AIC
## - TroponinT_max 1 10115
## - Temp_min 1 10115
## - HR_max 1 10115
## - Weight_max 1 10116
## <none> 10116
## - RespRate_max 1 10116
## - RespRate_min 1 10116
## - WBC_min 1 10116
## - WBC_max 1 10116
## - Bilirubin_max 1 10117
## - Albumin_min 1 10117
## - HR_min 1 10117
## - pH_min 1 10117
## - HCO3_min 1 10118
## - Urine_min 1 10118
## - Temp_max 1 10119
## - Lactate_max 1 10119
## - Na_max 1 10135
## - BUN_max 1 10164
## - GCS_max 1 10171
## - ICUType 3 10182
## - Age 1 10268
##
## Step: AIC=10114.75
## Surv(Days, Status) ~ Age + ICUType + Weight_max + Albumin_min +
## Bilirubin_max + BUN_max + GCS_max + HCO3_min + HR_min + HR_max +
## Lactate_max + Na_max + pH_min + RespRate_min + RespRate_max +
## Temp_min + Temp_max + Urine_min + WBC_min + WBC_max
##
## Df AIC
## - Temp_min 1 10114
## - HR_max 1 10114
## - Weight_max 1 10115
## <none> 10115
## - RespRate_min 1 10115
## - RespRate_max 1 10115
## - WBC_max 1 10116
## - WBC_min 1 10116
## - Albumin_min 1 10116
## - HR_min 1 10116
## - Bilirubin_max 1 10116
## - HCO3_min 1 10117
## - pH_min 1 10118
## - Urine_min 1 10118
## - Temp_max 1 10118
## - Lactate_max 1 10120
## - Na_max 1 10134
## - BUN_max 1 10163
## - GCS_max 1 10170
## - ICUType 3 10182
## - Age 1 10266
##
## Step: AIC=10113.91
## Surv(Days, Status) ~ Age + ICUType + Weight_max + Albumin_min +
## Bilirubin_max + BUN_max + GCS_max + HCO3_min + HR_min + HR_max +
## Lactate_max + Na_max + pH_min + RespRate_min + RespRate_max +
## Temp_max + Urine_min + WBC_min + WBC_max
##
## Df AIC
## - HR_max 1 10113
## <none> 10114
## - Weight_max 1 10114
## - RespRate_max 1 10114
## - RespRate_min 1 10114
## - WBC_min 1 10115
## - WBC_max 1 10115
## - HR_min 1 10115
## - Bilirubin_max 1 10115
## - Albumin_min 1 10115
## - HCO3_min 1 10116
## - pH_min 1 10117
## - Urine_min 1 10117
## - Lactate_max 1 10120
## - Temp_max 1 10120
## - Na_max 1 10133
## - BUN_max 1 10162
## - GCS_max 1 10170
## - ICUType 3 10180
## - Age 1 10265
##
## Step: AIC=10113.1
## Surv(Days, Status) ~ Age + ICUType + Weight_max + Albumin_min +
## Bilirubin_max + BUN_max + GCS_max + HCO3_min + HR_min + Lactate_max +
## Na_max + pH_min + RespRate_min + RespRate_max + Temp_max +
## Urine_min + WBC_min + WBC_max
##
## Df AIC
## <none> 10113
## - RespRate_min 1 10113
## - RespRate_max 1 10114
## - WBC_max 1 10114
## - Weight_max 1 10114
## - WBC_min 1 10114
## - Bilirubin_max 1 10114
## - Albumin_min 1 10115
## - HCO3_min 1 10115
## - pH_min 1 10116
## - Urine_min 1 10117
## - HR_min 1 10117
## - Temp_max 1 10119
## - Lactate_max 1 10120
## - Na_max 1 10132
## - BUN_max 1 10160
## - GCS_max 1 10169
## - ICUType 3 10182
## - Age 1 10265
summary(ICU.mv_reduced3)
## Call:
## coxph(formula = Surv(Days, Status) ~ Age + ICUType + Weight_max +
## Albumin_min + Bilirubin_max + BUN_max + GCS_max + HCO3_min +
## HR_min + Lactate_max + Na_max + pH_min + RespRate_min + RespRate_max +
## Temp_max + Urine_min + WBC_min + WBC_max, data = nm_icu_model_df1)
##
## n= 1915, number of events= 721
##
## coef exp(coef) se(coef) z
## Age 0.0337030 1.0342774 0.0028800 11.703
## ICUTypeCardiac Surgery Recovery Unit -0.7585749 0.4683334 0.1455045 -5.213
## ICUTypeMedical ICU 0.2665894 1.3055043 0.1118935 2.383
## ICUTypeSurgical ICU -0.0597760 0.9419755 0.1289216 -0.464
## Weight_max -0.0028717 0.9971324 0.0018165 -1.581
## Albumin_min -0.1217041 0.8854103 0.0647304 -1.880
## Bilirubin_max 0.0151357 1.0152509 0.0078127 1.937
## BUN_max 0.0108042 1.0108628 0.0014283 7.564
## GCS_max -0.1088301 0.8968828 0.0138841 -7.838
## HCO3_min 0.0174338 1.0175867 0.0089639 1.945
## HR_min 0.0064653 1.0064862 0.0026116 2.476
## Lactate_max 0.0570025 1.0586585 0.0186807 3.051
## Na_max -0.0358594 0.9647759 0.0079585 -4.506
## pH_min -0.5088123 0.6012092 0.1823407 -2.790
## RespRate_min -0.0196914 0.9805013 0.0128529 -1.532
## RespRate_max 0.0091086 1.0091502 0.0056285 1.618
## Temp_max -0.1436890 0.8661571 0.0527479 -2.724
## Urine_min -0.0020642 0.9979380 0.0009474 -2.179
## WBC_min 0.0221331 1.0223798 0.0136925 1.616
## WBC_max -0.0178972 0.9822620 0.0114290 -1.566
## Pr(>|z|)
## Age < 0.0000000000000002 ***
## ICUTypeCardiac Surgery Recovery Unit 0.00000018539857563 ***
## ICUTypeMedical ICU 0.01719 *
## ICUTypeSurgical ICU 0.64289
## Weight_max 0.11391
## Albumin_min 0.06008 .
## Bilirubin_max 0.05271 .
## BUN_max 0.00000000000003898 ***
## GCS_max 0.00000000000000456 ***
## HCO3_min 0.05179 .
## HR_min 0.01330 *
## Lactate_max 0.00228 **
## Na_max 0.00000661319368369 ***
## pH_min 0.00526 **
## RespRate_min 0.12551
## RespRate_max 0.10560
## Temp_max 0.00645 **
## Urine_min 0.02934 *
## WBC_min 0.10600
## WBC_max 0.11736
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## Age 1.0343 0.9669 1.0285 1.0401
## ICUTypeCardiac Surgery Recovery Unit 0.4683 2.1352 0.3521 0.6229
## ICUTypeMedical ICU 1.3055 0.7660 1.0484 1.6256
## ICUTypeSurgical ICU 0.9420 1.0616 0.7316 1.2128
## Weight_max 0.9971 1.0029 0.9936 1.0007
## Albumin_min 0.8854 1.1294 0.7799 1.0052
## Bilirubin_max 1.0153 0.9850 0.9998 1.0309
## BUN_max 1.0109 0.9893 1.0080 1.0137
## GCS_max 0.8969 1.1150 0.8728 0.9216
## HCO3_min 1.0176 0.9827 0.9999 1.0356
## HR_min 1.0065 0.9936 1.0013 1.0117
## Lactate_max 1.0587 0.9446 1.0206 1.0981
## Na_max 0.9648 1.0365 0.9498 0.9799
## pH_min 0.6012 1.6633 0.4205 0.8595
## RespRate_min 0.9805 1.0199 0.9561 1.0055
## RespRate_max 1.0092 0.9909 0.9981 1.0203
## Temp_max 0.8662 1.1545 0.7811 0.9605
## Urine_min 0.9979 1.0021 0.9961 0.9998
## WBC_min 1.0224 0.9781 0.9953 1.0502
## WBC_max 0.9823 1.0181 0.9605 1.0045
##
## Concordance= 0.741 (se = 0.009 )
## Likelihood ratio test= 511.4 on 20 df, p=<0.0000000000000002
## Wald test = 497.9 on 20 df, p=<0.0000000000000002
## Score (logrank) test = 541.4 on 20 df, p=<0.0000000000000002
## Interestingly: GCS_max, HR_min & Na_max have worked their way back in (not significant on log-rank)
# Calculate 3rd reduced model AIC
AIC.mv_reduced3 <- calc_aic(ICU.mv_reduced3)
AIC.mv_reduced3 #10113
## [1] 10113.1
# 4th reduced model using significant variables (using cut off p < 0.1) from ICU.mv_reduced3
ICU.mv_reduced4 <- coxph(Surv(Days, Status) ~
Age + ICUType + Albumin_min + Bilirubin_max + BUN_max +
GCS_max + HCO3_min + HR_min + Lactate_max + Na_max +
pH_min + Temp_max + Urine_min,
data = nm_icu_model_df1)
summary(ICU.mv_reduced4)
## Call:
## coxph(formula = Surv(Days, Status) ~ Age + ICUType + Albumin_min +
## Bilirubin_max + BUN_max + GCS_max + HCO3_min + HR_min + Lactate_max +
## Na_max + pH_min + Temp_max + Urine_min, data = nm_icu_model_df1)
##
## n= 1915, number of events= 721
##
## coef exp(coef) se(coef) z
## Age 0.0350388 1.0356599 0.0027689 12.654
## ICUTypeCardiac Surgery Recovery Unit -0.7506795 0.4720457 0.1436016 -5.228
## ICUTypeMedical ICU 0.2966536 1.3453492 0.1113497 2.664
## ICUTypeSurgical ICU -0.0489970 0.9521840 0.1281524 -0.382
## Albumin_min -0.0975028 0.9070998 0.0640981 -1.521
## Bilirubin_max 0.0176857 1.0178431 0.0075944 2.329
## BUN_max 0.0103542 1.0104080 0.0013927 7.435
## GCS_max -0.1025152 0.9025644 0.0122724 -8.353
## HCO3_min 0.0169520 1.0170965 0.0086722 1.955
## HR_min 0.0064894 1.0065105 0.0025183 2.577
## Lactate_max 0.0560927 1.0576957 0.0185001 3.032
## Na_max -0.0362758 0.9643743 0.0078693 -4.610
## pH_min -0.4684910 0.6259461 0.1892577 -2.475
## Temp_max -0.1537885 0.8574533 0.0518889 -2.964
## Urine_min -0.0019496 0.9980523 0.0009352 -2.085
## Pr(>|z|)
## Age < 0.0000000000000002 ***
## ICUTypeCardiac Surgery Recovery Unit 0.000000171804359 ***
## ICUTypeMedical ICU 0.00772 **
## ICUTypeSurgical ICU 0.70221
## Albumin_min 0.12822
## Bilirubin_max 0.01987 *
## BUN_max 0.000000000000105 ***
## GCS_max < 0.0000000000000002 ***
## HCO3_min 0.05061 .
## HR_min 0.00997 **
## Lactate_max 0.00243 **
## Na_max 0.000004031402074 ***
## pH_min 0.01331 *
## Temp_max 0.00304 **
## Urine_min 0.03710 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## Age 1.0357 0.9656 1.0301 1.0413
## ICUTypeCardiac Surgery Recovery Unit 0.4720 2.1184 0.3562 0.6255
## ICUTypeMedical ICU 1.3453 0.7433 1.0816 1.6735
## ICUTypeSurgical ICU 0.9522 1.0502 0.7407 1.2241
## Albumin_min 0.9071 1.1024 0.8000 1.0285
## Bilirubin_max 1.0178 0.9825 1.0028 1.0331
## BUN_max 1.0104 0.9897 1.0077 1.0132
## GCS_max 0.9026 1.1080 0.8811 0.9245
## HCO3_min 1.0171 0.9832 1.0000 1.0345
## HR_min 1.0065 0.9935 1.0016 1.0115
## Lactate_max 1.0577 0.9455 1.0200 1.0968
## Na_max 0.9644 1.0369 0.9496 0.9794
## pH_min 0.6259 1.5976 0.4320 0.9071
## Temp_max 0.8575 1.1662 0.7745 0.9492
## Urine_min 0.9981 1.0020 0.9962 0.9999
##
## Concordance= 0.738 (se = 0.009 )
## Likelihood ratio test= 501.6 on 15 df, p=<0.0000000000000002
## Wald test = 481.3 on 15 df, p=<0.0000000000000002
## Score (logrank) test = 519.6 on 15 df, p=<0.0000000000000002
# Calculate 4th reduced model AIC
AIC.mv_reduced4 <- calc_aic(ICU.mv_reduced4)
AIC.mv_reduced4 #10112
## [1] 10112.83
# Comparing models with LRT
lapply(list(ICU.mv_reduced1, ICU.mv_reduced2, ICU.mv_reduced3, ICU.mv_reduced4),
function(reduced) {print(anova(ICU.mv_full, reduced))} )
## Analysis of Deviance Table
## Cox model: response is Surv(Days, Status)
## Model 1: ~ Age + Gender + ICUType + Weight_max + Albumin_min + Bilirubin_max + BUN_max + Creatinine_max + GCS_max + Glucose_min + Glucose_max + HCO3_min + HR_min + HR_max + K_min + K_max + Lactate_max + MAP_min + Na_min + Na_max + Platelets_min + PFratio + pH_min + pH_max + RespRate_min + RespRate_max + Temp_min + Temp_max + TroponinT_max + TroponinI_max + Urine_min + WBC_min + WBC_max
## Model 2: ~ Age + ICUType + Weight_max + Albumin_min + Bilirubin_max + BUN_max + Creatinine_max + Glucose_max + HCO3_min + K_max + Lactate_max + MAP_min + Na_min + pH_min + pH_max + RespRate_min + RespRate_max + Temp_min + Temp_max + TroponinT_max + Urine_min
## loglik Chisq Df P(>|Chi|)
## 1 -5033.0
## 2 -5066.2 66.37 12 0.00000000152 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Analysis of Deviance Table
## Cox model: response is Surv(Days, Status)
## Model 1: ~ Age + Gender + ICUType + Weight_max + Albumin_min + Bilirubin_max + BUN_max + Creatinine_max + GCS_max + Glucose_min + Glucose_max + HCO3_min + HR_min + HR_max + K_min + K_max + Lactate_max + MAP_min + Na_min + Na_max + Platelets_min + PFratio + pH_min + pH_max + RespRate_min + RespRate_max + Temp_min + Temp_max + TroponinT_max + TroponinI_max + Urine_min + WBC_min + WBC_max
## Model 2: ~ Age + ICUType + Albumin_min + Bilirubin_max + BUN_max + HCO3_min + Lactate_max + Na_min + pH_min + RespRate_max + Urine_min
## loglik Chisq Df P(>|Chi|)
## 1 -5033.0
## 2 -5072.7 79.388 22 0.00000002043 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Analysis of Deviance Table
## Cox model: response is Surv(Days, Status)
## Model 1: ~ Age + Gender + ICUType + Weight_max + Albumin_min + Bilirubin_max + BUN_max + Creatinine_max + GCS_max + Glucose_min + Glucose_max + HCO3_min + HR_min + HR_max + K_min + K_max + Lactate_max + MAP_min + Na_min + Na_max + Platelets_min + PFratio + pH_min + pH_max + RespRate_min + RespRate_max + Temp_min + Temp_max + TroponinT_max + TroponinI_max + Urine_min + WBC_min + WBC_max
## Model 2: ~ Age + ICUType + Weight_max + Albumin_min + Bilirubin_max + BUN_max + GCS_max + HCO3_min + HR_min + Lactate_max + Na_max + pH_min + RespRate_min + RespRate_max + Temp_max + Urine_min + WBC_min + WBC_max
## loglik Chisq Df P(>|Chi|)
## 1 -5033.0
## 2 -5036.5 7.1483 15 0.9534
## Analysis of Deviance Table
## Cox model: response is Surv(Days, Status)
## Model 1: ~ Age + Gender + ICUType + Weight_max + Albumin_min + Bilirubin_max + BUN_max + Creatinine_max + GCS_max + Glucose_min + Glucose_max + HCO3_min + HR_min + HR_max + K_min + K_max + Lactate_max + MAP_min + Na_min + Na_max + Platelets_min + PFratio + pH_min + pH_max + RespRate_min + RespRate_max + Temp_min + Temp_max + TroponinT_max + TroponinI_max + Urine_min + WBC_min + WBC_max
## Model 2: ~ Age + ICUType + Albumin_min + Bilirubin_max + BUN_max + GCS_max + HCO3_min + HR_min + Lactate_max + Na_max + pH_min + Temp_max + Urine_min
## loglik Chisq Df P(>|Chi|)
## 1 -5033.0
## 2 -5041.4 16.877 20 0.6609
## [[1]]
## Analysis of Deviance Table
## Cox model: response is Surv(Days, Status)
## Model 1: ~ Age + Gender + ICUType + Weight_max + Albumin_min + Bilirubin_max + BUN_max + Creatinine_max + GCS_max + Glucose_min + Glucose_max + HCO3_min + HR_min + HR_max + K_min + K_max + Lactate_max + MAP_min + Na_min + Na_max + Platelets_min + PFratio + pH_min + pH_max + RespRate_min + RespRate_max + Temp_min + Temp_max + TroponinT_max + TroponinI_max + Urine_min + WBC_min + WBC_max
## Model 2: ~ Age + ICUType + Weight_max + Albumin_min + Bilirubin_max + BUN_max + Creatinine_max + Glucose_max + HCO3_min + K_max + Lactate_max + MAP_min + Na_min + pH_min + pH_max + RespRate_min + RespRate_max + Temp_min + Temp_max + TroponinT_max + Urine_min
## loglik Chisq Df P(>|Chi|)
## 1 -5033.0
## 2 -5066.2 66.37 12 0.00000000152 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## [[2]]
## Analysis of Deviance Table
## Cox model: response is Surv(Days, Status)
## Model 1: ~ Age + Gender + ICUType + Weight_max + Albumin_min + Bilirubin_max + BUN_max + Creatinine_max + GCS_max + Glucose_min + Glucose_max + HCO3_min + HR_min + HR_max + K_min + K_max + Lactate_max + MAP_min + Na_min + Na_max + Platelets_min + PFratio + pH_min + pH_max + RespRate_min + RespRate_max + Temp_min + Temp_max + TroponinT_max + TroponinI_max + Urine_min + WBC_min + WBC_max
## Model 2: ~ Age + ICUType + Albumin_min + Bilirubin_max + BUN_max + HCO3_min + Lactate_max + Na_min + pH_min + RespRate_max + Urine_min
## loglik Chisq Df P(>|Chi|)
## 1 -5033.0
## 2 -5072.7 79.388 22 0.00000002043 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## [[3]]
## Analysis of Deviance Table
## Cox model: response is Surv(Days, Status)
## Model 1: ~ Age + Gender + ICUType + Weight_max + Albumin_min + Bilirubin_max + BUN_max + Creatinine_max + GCS_max + Glucose_min + Glucose_max + HCO3_min + HR_min + HR_max + K_min + K_max + Lactate_max + MAP_min + Na_min + Na_max + Platelets_min + PFratio + pH_min + pH_max + RespRate_min + RespRate_max + Temp_min + Temp_max + TroponinT_max + TroponinI_max + Urine_min + WBC_min + WBC_max
## Model 2: ~ Age + ICUType + Weight_max + Albumin_min + Bilirubin_max + BUN_max + GCS_max + HCO3_min + HR_min + Lactate_max + Na_max + pH_min + RespRate_min + RespRate_max + Temp_max + Urine_min + WBC_min + WBC_max
## loglik Chisq Df P(>|Chi|)
## 1 -5033.0
## 2 -5036.5 7.1483 15 0.9534
##
## [[4]]
## Analysis of Deviance Table
## Cox model: response is Surv(Days, Status)
## Model 1: ~ Age + Gender + ICUType + Weight_max + Albumin_min + Bilirubin_max + BUN_max + Creatinine_max + GCS_max + Glucose_min + Glucose_max + HCO3_min + HR_min + HR_max + K_min + K_max + Lactate_max + MAP_min + Na_min + Na_max + Platelets_min + PFratio + pH_min + pH_max + RespRate_min + RespRate_max + Temp_min + Temp_max + TroponinT_max + TroponinI_max + Urine_min + WBC_min + WBC_max
## Model 2: ~ Age + ICUType + Albumin_min + Bilirubin_max + BUN_max + GCS_max + HCO3_min + HR_min + Lactate_max + Na_max + pH_min + Temp_max + Urine_min
## loglik Chisq Df P(>|Chi|)
## 1 -5033.0
## 2 -5041.4 16.877 20 0.6609
## Results: reduced1 and reduced2 - reject the null hypothesis that the reduced models are better (they are worse)
## reduced3 and reduced4 - DONT reject the null hypothesis
## --> therefore the reduced models are better than the full model (matches our AICs)
# Print the AICs all together to review
aic_output <- c(AIC.mv_full, AIC.mv_reduced1, AIC.mv_reduced2, AIC.mv_reduced3, AIC.mv_reduced4)
names(aic_output) <- c('Full AIC', 'Reduced 1 AIC', 'Reduced 2 AIC', 'Reduced 3 AIC', 'Reduced 4 AIC')
print(aic_output)
## Full AIC Reduced 1 AIC Reduced 2 AIC Reduced 3 AIC Reduced 4 AIC
## 10135.95 10178.32 10171.34 10113.10 10112.83
## Decision: use ICU.mv_reduced4 as the provisional final model (lowest AIC and non-significant LRT)
## Note: the full model still has the largest (best) maximised log-likelihood, but we choose the simplified model for parsimony
commentary …
## Testing assumptions ##
# Testing for proportional hazards assumption of ICU.mv_reduced4 using cox.zph()
cox.zph(ICU.mv_reduced4, terms=FALSE)
## chisq df p
## Age 1.04471 1 0.30673
## ICUTypeCardiac Surgery Recovery Unit 10.34626 1 0.00130
## ICUTypeMedical ICU 0.00654 1 0.93553
## ICUTypeSurgical ICU 4.60886 1 0.03181
## Albumin_min 12.67940 1 0.00037
## Bilirubin_max 11.96366 1 0.00054
## BUN_max 0.93552 1 0.33343
## GCS_max 25.48016 1 0.000000446955
## HCO3_min 25.17651 1 0.000000523154
## HR_min 4.47650 1 0.03436
## Lactate_max 32.07772 1 0.000000014813
## Na_max 0.05096 1 0.82140
## pH_min 0.41234 1 0.52078
## Temp_max 1.89556 1 0.16858
## Urine_min 3.24395 1 0.07169
## GLOBAL 89.96094 15 0.000000000001
## Result: statistically significant global test, therefore the proportional hazards model is violated
## (the variables that violate are: ICUType, Albumin_min, Bilirubin_max, GCS_max, HCO3_min, HR_min, Lactate_max)
# Including time x covariate interactions to fix proportional hazards for problematic variables
# Split the dataset at 90 days (~ 3 months)
# Suspect there may be some systematic differences in patients who survive less than or greater than 3 months after ICU admission
ICU.split <- survSplit(Surv(Days, Status) ~ ., data = nm_icu_model_df1, cut=c(90), episode= "tgroup", id="id2")
head(ICU.split)
## RecordID in_hospital_death Age Gender ICUType
## 1 132540 0 76 Male Cardiac Surgery Recovery Unit
## 2 132540 0 76 Male Cardiac Surgery Recovery Unit
## 3 132541 0 44 Female Medical ICU
## 4 132541 0 44 Female Medical ICU
## 5 132543 0 68 Male Medical ICU
## 6 132543 0 68 Male Medical ICU
## Weight_max Albumin_min Bilirubin_max BUN_max Creatinine_max GCS_max
## 1 80.6 2.2 1.2 18 1.2 15
## 2 80.6 2.2 1.2 18 1.2 15
## 3 56.7 2.3 3.0 8 0.4 8
## 4 56.7 2.3 3.0 8 0.4 8
## 5 84.6 4.4 0.2 23 0.9 15
## 6 84.6 4.4 0.2 23 0.9 15
## Glucose_min Glucose_max HCO3_min HR_min HR_max K_min K_max Lactate_max
## 1 105 105 21 80 88 4.3 4.3 2.9
## 2 105 105 21 80 88 4.3 4.3 2.9
## 3 119 141 24 57 113 3.3 8.6 1.9
## 4 119 141 24 57 113 3.3 8.6 1.9
## 5 106 129 27 57 88 4.0 4.2 1.2
## 6 106 129 27 57 88 4.0 4.2 1.2
## MAP_min Na_min Na_max Platelets_min PFratio pH_min pH_max RespRate_min
## 1 43 139 139 164 89 7.34 7.45 11
## 2 43 139 139 164 89 7.34 7.45 11
## 3 71 137 140 72 65 7.51 7.51 18
## 4 71 137 140 72 65 7.51 7.51 18
## 5 72 140 141 315 64 7.47 7.51 12
## 6 72 140 141 315 64 7.47 7.51 12
## RespRate_max Temp_min Temp_max TroponinT_max TroponinI_max Urine_min WBC_min
## 1 36 34.5 37.9 0.43 31.7 0 7.4
## 2 36 34.5 37.9 0.43 31.7 0 7.4
## 3 33 36.7 39.0 1.55 33.4 30 3.7
## 4 33 36.7 39.0 1.55 33.4 30 3.7
## 5 21 35.1 36.7 0.10 5.9 100 8.8
## 6 21 35.1 36.7 0.10 5.9 100 8.8
## WBC_max id2 tstart Days Status tgroup
## 1 13.1 1 0 90 0 1
## 2 13.1 1 90 2408 0 2
## 3 4.2 2 0 90 0 1
## 4 4.2 2 90 2408 0 2
## 5 11.5 3 0 90 0 1
## 6 11.5 3 90 575 1 2
# Fit the model with time x covariate interactions
ICU.mv_reduced4.split <- coxph(Surv(Days, Status) ~
Age + ICUType:strata(tgroup) +
Albumin_min:strata(tgroup) +
Bilirubin_max:strata(tgroup) + BUN_max +
GCS_max:strata(tgroup) + HCO3_min:strata(tgroup) +
HR_min:strata(tgroup) +
Lactate_max:strata(tgroup) + Na_max + pH_min +
Temp_max + Urine_min,
data = ICU.split)
summary(ICU.mv_reduced4.split)
## Call:
## coxph(formula = Surv(Days, Status) ~ Age + ICUType:strata(tgroup) +
## Albumin_min:strata(tgroup) + Bilirubin_max:strata(tgroup) +
## BUN_max + GCS_max:strata(tgroup) + HCO3_min:strata(tgroup) +
## HR_min:strata(tgroup) + Lactate_max:strata(tgroup) + Na_max +
## pH_min + Temp_max + Urine_min, data = ICU.split)
##
## n= 3448, number of events= 721
##
## coef
## Age 0.0346090
## BUN_max 0.0102853
## Na_max -0.0373177
## pH_min -0.4234153
## Temp_max -0.1532807
## Urine_min -0.0018609
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=1 0.0334824
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=1 -1.1587488
## ICUTypeMedical ICU:strata(tgroup)tgroup=1 0.1907664
## ICUTypeSurgical ICU:strata(tgroup)tgroup=1 NA
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=2 0.0755461
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=2 -0.3034695
## ICUTypeMedical ICU:strata(tgroup)tgroup=2 0.5346959
## ICUTypeSurgical ICU:strata(tgroup)tgroup=2 NA
## strata(tgroup)tgroup=1:Albumin_min -0.2316071
## strata(tgroup)tgroup=2:Albumin_min 0.0295442
## strata(tgroup)tgroup=1:Bilirubin_max 0.0294162
## strata(tgroup)tgroup=2:Bilirubin_max -0.0166200
## strata(tgroup)tgroup=1:GCS_max -0.1284553
## strata(tgroup)tgroup=2:GCS_max -0.0686016
## strata(tgroup)tgroup=1:HCO3_min -0.0017832
## strata(tgroup)tgroup=2:HCO3_min 0.0399073
## strata(tgroup)tgroup=1:HR_min 0.0092707
## strata(tgroup)tgroup=2:HR_min 0.0021339
## strata(tgroup)tgroup=1:Lactate_max 0.0847352
## strata(tgroup)tgroup=2:Lactate_max -0.0122143
## exp(coef)
## Age 1.0352149
## BUN_max 1.0103384
## Na_max 0.9633700
## pH_min 0.6548066
## Temp_max 0.8578889
## Urine_min 0.9981409
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=1 1.0340493
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=1 0.3138787
## ICUTypeMedical ICU:strata(tgroup)tgroup=1 1.2101767
## ICUTypeSurgical ICU:strata(tgroup)tgroup=1 NA
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=2 1.0784730
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=2 0.7382524
## ICUTypeMedical ICU:strata(tgroup)tgroup=2 1.7069291
## ICUTypeSurgical ICU:strata(tgroup)tgroup=2 NA
## strata(tgroup)tgroup=1:Albumin_min 0.7932578
## strata(tgroup)tgroup=2:Albumin_min 1.0299849
## strata(tgroup)tgroup=1:Bilirubin_max 1.0298531
## strata(tgroup)tgroup=2:Bilirubin_max 0.9835173
## strata(tgroup)tgroup=1:GCS_max 0.8794529
## strata(tgroup)tgroup=2:GCS_max 0.9336986
## strata(tgroup)tgroup=1:HCO3_min 0.9982184
## strata(tgroup)tgroup=2:HCO3_min 1.0407143
## strata(tgroup)tgroup=1:HR_min 1.0093138
## strata(tgroup)tgroup=2:HR_min 1.0021362
## strata(tgroup)tgroup=1:Lactate_max 1.0884289
## strata(tgroup)tgroup=2:Lactate_max 0.9878600
## se(coef) z
## Age 0.0027578 12.550
## BUN_max 0.0013839 7.432
## Na_max 0.0078838 -4.733
## pH_min 0.1948427 -2.173
## Temp_max 0.0519571 -2.950
## Urine_min 0.0009391 -1.982
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=1 0.1693702 0.198
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=1 0.2046760 -5.661
## ICUTypeMedical ICU:strata(tgroup)tgroup=1 0.1313555 1.452
## ICUTypeSurgical ICU:strata(tgroup)tgroup=1 0.0000000 NA
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=2 0.1898386 0.398
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=2 0.1780409 -1.704
## ICUTypeMedical ICU:strata(tgroup)tgroup=2 0.1497039 3.572
## ICUTypeSurgical ICU:strata(tgroup)tgroup=2 0.0000000 NA
## strata(tgroup)tgroup=1:Albumin_min 0.0876911 -2.641
## strata(tgroup)tgroup=2:Albumin_min 0.0932320 0.317
## strata(tgroup)tgroup=1:Bilirubin_max 0.0081990 3.588
## strata(tgroup)tgroup=2:Bilirubin_max 0.0176978 -0.939
## strata(tgroup)tgroup=1:GCS_max 0.0157474 -8.157
## strata(tgroup)tgroup=2:GCS_max 0.0190971 -3.592
## strata(tgroup)tgroup=1:HCO3_min 0.0116061 -0.154
## strata(tgroup)tgroup=2:HCO3_min 0.0122847 3.249
## strata(tgroup)tgroup=1:HR_min 0.0032363 2.865
## strata(tgroup)tgroup=2:HR_min 0.0038392 0.556
## strata(tgroup)tgroup=1:Lactate_max 0.0205997 4.113
## strata(tgroup)tgroup=2:Lactate_max 0.0345008 -0.354
## Pr(>|z|)
## Age < 0.0000000000000002
## BUN_max 0.000000000000107052
## Na_max 0.000002207204558216
## pH_min 0.029772
## Temp_max 0.003176
## Urine_min 0.047532
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=1 0.843289
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=1 0.000000015015891605
## ICUTypeMedical ICU:strata(tgroup)tgroup=1 0.146421
## ICUTypeSurgical ICU:strata(tgroup)tgroup=1 NA
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=2 0.690668
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=2 0.088289
## ICUTypeMedical ICU:strata(tgroup)tgroup=2 0.000355
## ICUTypeSurgical ICU:strata(tgroup)tgroup=2 NA
## strata(tgroup)tgroup=1:Albumin_min 0.008262
## strata(tgroup)tgroup=2:Albumin_min 0.751328
## strata(tgroup)tgroup=1:Bilirubin_max 0.000334
## strata(tgroup)tgroup=2:Bilirubin_max 0.347680
## strata(tgroup)tgroup=1:GCS_max 0.000000000000000343
## strata(tgroup)tgroup=2:GCS_max 0.000328
## strata(tgroup)tgroup=1:HCO3_min 0.877893
## strata(tgroup)tgroup=2:HCO3_min 0.001160
## strata(tgroup)tgroup=1:HR_min 0.004176
## strata(tgroup)tgroup=2:HR_min 0.578339
## strata(tgroup)tgroup=1:Lactate_max 0.000038982884543304
## strata(tgroup)tgroup=2:Lactate_max 0.723318
##
## Age ***
## BUN_max ***
## Na_max ***
## pH_min *
## Temp_max **
## Urine_min *
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=1
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=1 ***
## ICUTypeMedical ICU:strata(tgroup)tgroup=1
## ICUTypeSurgical ICU:strata(tgroup)tgroup=1
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=2
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=2 .
## ICUTypeMedical ICU:strata(tgroup)tgroup=2 ***
## ICUTypeSurgical ICU:strata(tgroup)tgroup=2
## strata(tgroup)tgroup=1:Albumin_min **
## strata(tgroup)tgroup=2:Albumin_min
## strata(tgroup)tgroup=1:Bilirubin_max ***
## strata(tgroup)tgroup=2:Bilirubin_max
## strata(tgroup)tgroup=1:GCS_max ***
## strata(tgroup)tgroup=2:GCS_max ***
## strata(tgroup)tgroup=1:HCO3_min
## strata(tgroup)tgroup=2:HCO3_min **
## strata(tgroup)tgroup=1:HR_min **
## strata(tgroup)tgroup=2:HR_min
## strata(tgroup)tgroup=1:Lactate_max ***
## strata(tgroup)tgroup=2:Lactate_max
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef)
## Age 1.0352
## BUN_max 1.0103
## Na_max 0.9634
## pH_min 0.6548
## Temp_max 0.8579
## Urine_min 0.9981
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=1 1.0340
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=1 0.3139
## ICUTypeMedical ICU:strata(tgroup)tgroup=1 1.2102
## ICUTypeSurgical ICU:strata(tgroup)tgroup=1 NA
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=2 1.0785
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=2 0.7383
## ICUTypeMedical ICU:strata(tgroup)tgroup=2 1.7069
## ICUTypeSurgical ICU:strata(tgroup)tgroup=2 NA
## strata(tgroup)tgroup=1:Albumin_min 0.7933
## strata(tgroup)tgroup=2:Albumin_min 1.0300
## strata(tgroup)tgroup=1:Bilirubin_max 1.0299
## strata(tgroup)tgroup=2:Bilirubin_max 0.9835
## strata(tgroup)tgroup=1:GCS_max 0.8795
## strata(tgroup)tgroup=2:GCS_max 0.9337
## strata(tgroup)tgroup=1:HCO3_min 0.9982
## strata(tgroup)tgroup=2:HCO3_min 1.0407
## strata(tgroup)tgroup=1:HR_min 1.0093
## strata(tgroup)tgroup=2:HR_min 1.0021
## strata(tgroup)tgroup=1:Lactate_max 1.0884
## strata(tgroup)tgroup=2:Lactate_max 0.9879
## exp(-coef)
## Age 0.9660
## BUN_max 0.9898
## Na_max 1.0380
## pH_min 1.5272
## Temp_max 1.1657
## Urine_min 1.0019
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=1 0.9671
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=1 3.1859
## ICUTypeMedical ICU:strata(tgroup)tgroup=1 0.8263
## ICUTypeSurgical ICU:strata(tgroup)tgroup=1 NA
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=2 0.9272
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=2 1.3546
## ICUTypeMedical ICU:strata(tgroup)tgroup=2 0.5858
## ICUTypeSurgical ICU:strata(tgroup)tgroup=2 NA
## strata(tgroup)tgroup=1:Albumin_min 1.2606
## strata(tgroup)tgroup=2:Albumin_min 0.9709
## strata(tgroup)tgroup=1:Bilirubin_max 0.9710
## strata(tgroup)tgroup=2:Bilirubin_max 1.0168
## strata(tgroup)tgroup=1:GCS_max 1.1371
## strata(tgroup)tgroup=2:GCS_max 1.0710
## strata(tgroup)tgroup=1:HCO3_min 1.0018
## strata(tgroup)tgroup=2:HCO3_min 0.9609
## strata(tgroup)tgroup=1:HR_min 0.9908
## strata(tgroup)tgroup=2:HR_min 0.9979
## strata(tgroup)tgroup=1:Lactate_max 0.9188
## strata(tgroup)tgroup=2:Lactate_max 1.0123
## lower .95 upper .95
## Age 1.0296 1.0408
## BUN_max 1.0076 1.0131
## Na_max 0.9486 0.9784
## pH_min 0.4470 0.9593
## Temp_max 0.7748 0.9499
## Urine_min 0.9963 1.0000
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=1 0.7419 1.4412
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=1 0.2102 0.4688
## ICUTypeMedical ICU:strata(tgroup)tgroup=1 0.9355 1.5655
## ICUTypeSurgical ICU:strata(tgroup)tgroup=1 NA NA
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=2 0.7434 1.5646
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=2 0.5208 1.0465
## ICUTypeMedical ICU:strata(tgroup)tgroup=2 1.2729 2.2890
## ICUTypeSurgical ICU:strata(tgroup)tgroup=2 NA NA
## strata(tgroup)tgroup=1:Albumin_min 0.6680 0.9420
## strata(tgroup)tgroup=2:Albumin_min 0.8580 1.2365
## strata(tgroup)tgroup=1:Bilirubin_max 1.0134 1.0465
## strata(tgroup)tgroup=2:Bilirubin_max 0.9500 1.0182
## strata(tgroup)tgroup=1:GCS_max 0.8527 0.9070
## strata(tgroup)tgroup=2:GCS_max 0.8994 0.9693
## strata(tgroup)tgroup=1:HCO3_min 0.9758 1.0212
## strata(tgroup)tgroup=2:HCO3_min 1.0160 1.0661
## strata(tgroup)tgroup=1:HR_min 1.0029 1.0157
## strata(tgroup)tgroup=2:HR_min 0.9946 1.0097
## strata(tgroup)tgroup=1:Lactate_max 1.0454 1.1333
## strata(tgroup)tgroup=2:Lactate_max 0.9233 1.0570
##
## Concordance= 0.748 (se = 0.009 )
## Likelihood ratio test= 564.7 on 24 df, p=<0.0000000000000002
## Wald test = 544.8 on 24 df, p=<0.0000000000000002
## Score (logrank) test = 593.4 on 24 df, p=<0.0000000000000002
# evaluating the proportional hazards assumption again, for the model with time x covariate interactions
cox.zph(ICU.mv_reduced4.split, terms=FALSE)
## chisq df p
## Age 0.16638 1 0.6833
## BUN_max 0.02835 1 0.8663
## Na_max 0.52712 1 0.4678
## pH_min 0.20377 1 0.6517
## Temp_max 0.36572 1 0.5453
## Urine_min 1.64748 1 0.1993
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=1 0.00282 1 0.9576
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=1 0.68770 1 0.4069
## ICUTypeMedical ICU:strata(tgroup)tgroup=1 0.00532 1 0.9419
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=2 0.11821 1 0.7310
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=2 2.10958 1 0.1464
## ICUTypeMedical ICU:strata(tgroup)tgroup=2 0.58893 1 0.4428
## strata(tgroup)tgroup=1:Albumin_min 2.32455 1 0.1273
## strata(tgroup)tgroup=2:Albumin_min 0.00195 1 0.9648
## strata(tgroup)tgroup=1:Bilirubin_max 0.92725 1 0.3356
## strata(tgroup)tgroup=2:Bilirubin_max 3.38839 1 0.0657
## strata(tgroup)tgroup=1:GCS_max 10.61588 1 0.0011
## strata(tgroup)tgroup=2:GCS_max 2.53281 1 0.1115
## strata(tgroup)tgroup=1:HCO3_min 4.83676 1 0.0279
## strata(tgroup)tgroup=2:HCO3_min 1.56563 1 0.2108
## strata(tgroup)tgroup=1:HR_min 0.97301 1 0.3239
## strata(tgroup)tgroup=2:HR_min 0.32407 1 0.5692
## strata(tgroup)tgroup=1:Lactate_max 5.00208 1 0.0253
## strata(tgroup)tgroup=2:Lactate_max 5.91846 1 0.0150
## GLOBAL 35.16653 24 0.0660
## Result: the global test is now insignificant (p = 0.07)
# Checking Linearity by observing Martingale residuals
# Refit the chosen model with any factor variables re-coded as numeric
# to allow the ggcoxfunctional() function to work
ICU.mv_reduced4.nofactor <- coxph(Surv(Days, Status) ~
Age + as.numeric(ICUType) + Albumin_min + Bilirubin_max + BUN_max +
GCS_max + HCO3_min + HR_min + Lactate_max + Na_max +
pH_min + Temp_max + Urine_min,
data = nm_icu_model_df1)
ggcoxfunctional(ICU.mv_reduced4.nofactor, nm_icu_model_df1)
## Result: they don't look particularly linear... especially with laboratory values very far from the reference ranges
## (likely few observations in this range / potential outliers)
# Check linearity of the model as a whole
ggcoxdiagnostics(ICU.mv_reduced4, type = "martingale", linear.predictions = FALSE, ggtheme = theme_bw())
## `geom_smooth()` using formula 'y ~ x'
## Result: appears reasonably linear with with 2 large negative outliers
## (large negative interpretation = 'lived too long')
# Examine the observations with very large negative residuals (< -3)
resid(ICU.mv_reduced4)[resid(ICU.mv_reduced4) < -3]
## 1511 1929
## -4.197771 -3.207614
icu_patients_df1[c(1511,1929),]
## RecordID Length_of_stay SAPS1 SOFA Survival in_hospital_death Days Status
## 1511 136398 51 22 10 NA 0 2408 FALSE
## 1929 137433 23 NA 7 NA 0 2408 FALSE
## Age Albumin_diff Albumin_max Albumin_min ALP_diff ALP_max ALP_min ALT_diff
## 1511 70 0.0186633 3.0 3.0 50.85204 45 74 105.4462
## 1929 78 0.6813367 2.3 2.3 57.14796 153 153 138.5538
## ALT_max ALT_min AST_diff AST_max AST_min Bilirubin_diff Bilirubin_max
## 1511 40 15 151.3527 18 57 1.364039 0.9
## 1929 259 259 203.6473 373 373 4.935961 6.7
## Bilirubin_min BUN_diff BUN_max BUN_min Cholesterol_diff Cholesterol_max
## 1511 0.4 99.47295 124 120 9.422764 147
## 1929 6.7 97.47295 122 122 81.422764 75
## Cholesterol_min Creatinine_diff Creatinine_max Creatinine_min DiasABP_diff
## 1511 147 5.167554 6.4 5.8 11.54421
## 1929 101 2.967554 4.2 4.2 NA
## DiasABP_max DiasABP_min FiO2_diff FiO2_max FiO2_min GCS_diff GCS_max
## 1511 67 47 0.4480799 1 0.4 6.244029 9
## 1929 NA NA 0.4480799 1 1.0 3.755971 15
## GCS_min Gender Glucose_diff Glucose_max Glucose_min HCO3_diff HCO3_max
## 1511 5 Female 142.14446 282 41 15.772548 10
## 1929 15 Male 66.85554 73 73 0.772548 22
## HCO3_min HCT_diff HCT_max HCT_min Height HR_diff HR_max HR_min
## 1511 7 10.460129 31.5 20.5 165.1 45.07789 70 42
## 1929 22 4.760129 26.2 26.2 177.8 27.07789 65 60
## ICUType K_diff K_max K_min Lactate_diff Lactate_max Lactate_min
## 1511 Medical ICU 0.6352066 3.9 3.5 4.803596 7.6 7.6
## 1929 Medical ICU 0.1352066 4.0 4.0 2.203596 5.0 1.6
## MAP_diff MAP_max MAP_min Mg_diff Mg_max Mg_min Na_diff Na_max Na_min
## 1511 120.23164 198 55 0.1842982 2.0 1.8 8.206607 133 131
## 1929 19.76836 58 65 0.6157018 2.6 2.6 6.206607 133 133
## NIDiasABP_diff NIDiasABP_max NIDiasABP_min NIMAP_diff NIMAP_max NIMAP_min
## 1511 20.49101 72 37 21.38069 84.67 54.33
## 1929 31.49101 82 26 24.04069 93.00 51.67
## NISysABP_diff NISysABP_max NISysABP_min PaCO2_diff PaCO2_max PaCO2_min
## 1511 37.69875 126 79 25.335797 22 15
## 1929 18.69875 119 98 4.335797 40 36
## PaO2_diff PaO2_max PaO2_min pH_diff pH_max pH_min Platelets_diff
## 1511 282.3821 441 120 0.14988624 7.31 7.22 77.76931
## 1929 108.6179 107 50 0.07988624 7.31 7.29 154.23069
## Platelets_max Platelets_min RespRate_diff RespRate_max RespRate_min
## 1511 150 112 10.65142 30 10
## 1929 344 344 11.65142 31 17
## SaO2_diff SaO2_max SaO2_min SysABP_diff SysABP_max SysABP_min Temp_diff
## 1511 0.7539211 98 98 42.3105 126 74 2.574083
## 1929 2.2460789 99 95 NA NA NA 1.174083
## Temp_max Temp_min TroponinI_diff TroponinI_max TroponinI_min
## 1511 36.1 34.4 1.542945 3.9 3.9
## 1929 37.9 35.8 3.742945 3.9 1.7
## TroponinT_diff TroponinT_max TroponinT_min Urine_diff Urine_max Urine_min
## 1511 0.6185006 0.27 0.05 99.21758 70 0
## 1929 3.3414994 4.01 1.67 99.21758 120 0
## WBC_diff WBC_max WBC_min Weight_diff Weight_max Weight_min PFratio
## 1511 3.7331524 9.8 8.4 2.499878 78.2 78.2 120
## 1929 0.6668476 12.8 12.8 4.699878 76.0 76.0 50
## Interpretation: looks like they were relatively elderly with long lengths of stay
## - one had low GCS values/high SAPS1/high lactate
## - the other had high bilirubin/deranged LFTs/high lactate
## Decision: remove these outliers and re-fit the model to the dataset excluding these observations -->
# Check the RecordIDs match up with the correct data in the non-missing, split dataset
ICU.split[(ICU.split$RecordID == 136398 | ICU.split$RecordID == 137433),]
## RecordID in_hospital_death Age Gender ICUType Weight_max Albumin_min
## 2512 136398 0 70 Female Medical ICU 78.2 3.0
## 2513 136398 0 70 Female Medical ICU 78.2 3.0
## 3226 137433 0 78 Male Medical ICU 76.0 2.3
## 3227 137433 0 78 Male Medical ICU 76.0 2.3
## Bilirubin_max BUN_max Creatinine_max GCS_max Glucose_min Glucose_max
## 2512 0.9 124 6.4 9 41 282
## 2513 0.9 124 6.4 9 41 282
## 3226 6.7 122 4.2 15 73 73
## 3227 6.7 122 4.2 15 73 73
## HCO3_min HR_min HR_max K_min K_max Lactate_max MAP_min Na_min Na_max
## 2512 7 42 70 3.5 3.9 7.6 55 131 133
## 2513 7 42 70 3.5 3.9 7.6 55 131 133
## 3226 22 60 65 4.0 4.0 5.0 65 133 133
## 3227 22 60 65 4.0 4.0 5.0 65 133 133
## Platelets_min PFratio pH_min pH_max RespRate_min RespRate_max Temp_min
## 2512 112 120 7.22 7.31 10 30 34.4
## 2513 112 120 7.22 7.31 10 30 34.4
## 3226 344 50 7.29 7.31 17 31 35.8
## 3227 344 50 7.29 7.31 17 31 35.8
## Temp_max TroponinT_max TroponinI_max Urine_min WBC_min WBC_max id2 tstart
## 2512 36.1 0.27 3.9 0 8.4 9.8 1400 0
## 2513 36.1 0.27 3.9 0 8.4 9.8 1400 90
## 3226 37.9 4.01 3.9 0 12.8 12.8 1792 0
## 3227 37.9 4.01 3.9 0 12.8 12.8 1792 90
## Days Status tgroup
## 2512 90 0 1
## 2513 2408 0 2
## 3226 90 0 1
## 3227 2408 0 2
# Remove these observations and save as new dataset
ICU.split_noutliers <- ICU.split[!(ICU.split$RecordID %in% c(136398, 137433)),]
# Refit the split model to the new dataset
ICU.mv_reduced4.split.noutliers <- coxph(Surv(Days, Status) ~
Age + ICUType:strata(tgroup) +
Albumin_min:strata(tgroup) +
Bilirubin_max:strata(tgroup) + BUN_max +
GCS_max:strata(tgroup) + HCO3_min:strata(tgroup) +
HR_min:strata(tgroup) +
Lactate_max:strata(tgroup) + Na_max + pH_min +
Temp_max + Urine_min,
data = ICU.split_noutliers)
summary(ICU.mv_reduced4.split.noutliers)
## Call:
## coxph(formula = Surv(Days, Status) ~ Age + ICUType:strata(tgroup) +
## Albumin_min:strata(tgroup) + Bilirubin_max:strata(tgroup) +
## BUN_max + GCS_max:strata(tgroup) + HCO3_min:strata(tgroup) +
## HR_min:strata(tgroup) + Lactate_max:strata(tgroup) + Na_max +
## pH_min + Temp_max + Urine_min, data = ICU.split_noutliers)
##
## n= 3444, number of events= 721
##
## coef
## Age 0.0345124
## BUN_max 0.0111342
## Na_max -0.0404555
## pH_min -0.4124840
## Temp_max -0.1582918
## Urine_min -0.0019812
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=1 0.0221166
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=1 -1.1586329
## ICUTypeMedical ICU:strata(tgroup)tgroup=1 0.2008633
## ICUTypeSurgical ICU:strata(tgroup)tgroup=1 NA
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=2 0.0655282
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=2 -0.3071060
## ICUTypeMedical ICU:strata(tgroup)tgroup=2 0.5463547
## ICUTypeSurgical ICU:strata(tgroup)tgroup=2 NA
## strata(tgroup)tgroup=1:Albumin_min -0.2312474
## strata(tgroup)tgroup=2:Albumin_min 0.0257121
## strata(tgroup)tgroup=1:Bilirubin_max 0.0287543
## strata(tgroup)tgroup=2:Bilirubin_max -0.0159728
## strata(tgroup)tgroup=1:GCS_max -0.1281817
## strata(tgroup)tgroup=2:GCS_max -0.0686489
## strata(tgroup)tgroup=1:HCO3_min -0.0033246
## strata(tgroup)tgroup=2:HCO3_min 0.0391071
## strata(tgroup)tgroup=1:HR_min 0.0081504
## strata(tgroup)tgroup=2:HR_min 0.0013052
## strata(tgroup)tgroup=1:Lactate_max 0.0904054
## strata(tgroup)tgroup=2:Lactate_max -0.0013510
## exp(coef)
## Age 1.0351149
## BUN_max 1.0111965
## Na_max 0.9603519
## pH_min 0.6620038
## Temp_max 0.8536006
## Urine_min 0.9980208
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=1 1.0223630
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=1 0.3139150
## ICUTypeMedical ICU:strata(tgroup)tgroup=1 1.2224577
## ICUTypeSurgical ICU:strata(tgroup)tgroup=1 NA
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=2 1.0677228
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=2 0.7355726
## ICUTypeMedical ICU:strata(tgroup)tgroup=2 1.7269462
## ICUTypeSurgical ICU:strata(tgroup)tgroup=2 NA
## strata(tgroup)tgroup=1:Albumin_min 0.7935431
## strata(tgroup)tgroup=2:Albumin_min 1.0260455
## strata(tgroup)tgroup=1:Bilirubin_max 1.0291717
## strata(tgroup)tgroup=2:Bilirubin_max 0.9841541
## strata(tgroup)tgroup=1:GCS_max 0.8796935
## strata(tgroup)tgroup=2:GCS_max 0.9336545
## strata(tgroup)tgroup=1:HCO3_min 0.9966809
## strata(tgroup)tgroup=2:HCO3_min 1.0398819
## strata(tgroup)tgroup=1:HR_min 1.0081837
## strata(tgroup)tgroup=2:HR_min 1.0013060
## strata(tgroup)tgroup=1:Lactate_max 1.0946180
## strata(tgroup)tgroup=2:Lactate_max 0.9986499
## se(coef) z
## Age 0.0027499 12.550
## BUN_max 0.0013776 8.082
## Na_max 0.0078816 -5.133
## pH_min 0.1978059 -2.085
## Temp_max 0.0521644 -3.034
## Urine_min 0.0009464 -2.093
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=1 0.1694156 0.131
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=1 0.2047092 -5.660
## ICUTypeMedical ICU:strata(tgroup)tgroup=1 0.1311915 1.531
## ICUTypeSurgical ICU:strata(tgroup)tgroup=1 0.0000000 NA
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=2 0.1898951 0.345
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=2 0.1780033 -1.725
## ICUTypeMedical ICU:strata(tgroup)tgroup=2 0.1496993 3.650
## ICUTypeSurgical ICU:strata(tgroup)tgroup=2 0.0000000 NA
## strata(tgroup)tgroup=1:Albumin_min 0.0875372 -2.642
## strata(tgroup)tgroup=2:Albumin_min 0.0932299 0.276
## strata(tgroup)tgroup=1:Bilirubin_max 0.0081724 3.518
## strata(tgroup)tgroup=2:Bilirubin_max 0.0173879 -0.919
## strata(tgroup)tgroup=1:GCS_max 0.0157330 -8.147
## strata(tgroup)tgroup=2:GCS_max 0.0190784 -3.598
## strata(tgroup)tgroup=1:HCO3_min 0.0117341 -0.283
## strata(tgroup)tgroup=2:HCO3_min 0.0123778 3.159
## strata(tgroup)tgroup=1:HR_min 0.0032554 2.504
## strata(tgroup)tgroup=2:HR_min 0.0038581 0.338
## strata(tgroup)tgroup=1:Lactate_max 0.0202818 4.457
## strata(tgroup)tgroup=2:Lactate_max 0.0342960 -0.039
## Pr(>|z|)
## Age < 0.0000000000000002
## BUN_max 0.000000000000000636
## Na_max 0.000000285293278950
## pH_min 0.037042
## Temp_max 0.002410
## Urine_min 0.036316
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=1 0.896134
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=1 0.000000015146402643
## ICUTypeMedical ICU:strata(tgroup)tgroup=1 0.125752
## ICUTypeSurgical ICU:strata(tgroup)tgroup=1 NA
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=2 0.730037
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=2 0.084477
## ICUTypeMedical ICU:strata(tgroup)tgroup=2 0.000263
## ICUTypeSurgical ICU:strata(tgroup)tgroup=2 NA
## strata(tgroup)tgroup=1:Albumin_min 0.008249
## strata(tgroup)tgroup=2:Albumin_min 0.782708
## strata(tgroup)tgroup=1:Bilirubin_max 0.000434
## strata(tgroup)tgroup=2:Bilirubin_max 0.358295
## strata(tgroup)tgroup=1:GCS_max 0.000000000000000372
## strata(tgroup)tgroup=2:GCS_max 0.000320
## strata(tgroup)tgroup=1:HCO3_min 0.776925
## strata(tgroup)tgroup=2:HCO3_min 0.001581
## strata(tgroup)tgroup=1:HR_min 0.012291
## strata(tgroup)tgroup=2:HR_min 0.735142
## strata(tgroup)tgroup=1:Lactate_max 0.000008293318325089
## strata(tgroup)tgroup=2:Lactate_max 0.968577
##
## Age ***
## BUN_max ***
## Na_max ***
## pH_min *
## Temp_max **
## Urine_min *
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=1
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=1 ***
## ICUTypeMedical ICU:strata(tgroup)tgroup=1
## ICUTypeSurgical ICU:strata(tgroup)tgroup=1
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=2
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=2 .
## ICUTypeMedical ICU:strata(tgroup)tgroup=2 ***
## ICUTypeSurgical ICU:strata(tgroup)tgroup=2
## strata(tgroup)tgroup=1:Albumin_min **
## strata(tgroup)tgroup=2:Albumin_min
## strata(tgroup)tgroup=1:Bilirubin_max ***
## strata(tgroup)tgroup=2:Bilirubin_max
## strata(tgroup)tgroup=1:GCS_max ***
## strata(tgroup)tgroup=2:GCS_max ***
## strata(tgroup)tgroup=1:HCO3_min
## strata(tgroup)tgroup=2:HCO3_min **
## strata(tgroup)tgroup=1:HR_min *
## strata(tgroup)tgroup=2:HR_min
## strata(tgroup)tgroup=1:Lactate_max ***
## strata(tgroup)tgroup=2:Lactate_max
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef)
## Age 1.0351
## BUN_max 1.0112
## Na_max 0.9604
## pH_min 0.6620
## Temp_max 0.8536
## Urine_min 0.9980
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=1 1.0224
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=1 0.3139
## ICUTypeMedical ICU:strata(tgroup)tgroup=1 1.2225
## ICUTypeSurgical ICU:strata(tgroup)tgroup=1 NA
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=2 1.0677
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=2 0.7356
## ICUTypeMedical ICU:strata(tgroup)tgroup=2 1.7269
## ICUTypeSurgical ICU:strata(tgroup)tgroup=2 NA
## strata(tgroup)tgroup=1:Albumin_min 0.7935
## strata(tgroup)tgroup=2:Albumin_min 1.0260
## strata(tgroup)tgroup=1:Bilirubin_max 1.0292
## strata(tgroup)tgroup=2:Bilirubin_max 0.9842
## strata(tgroup)tgroup=1:GCS_max 0.8797
## strata(tgroup)tgroup=2:GCS_max 0.9337
## strata(tgroup)tgroup=1:HCO3_min 0.9967
## strata(tgroup)tgroup=2:HCO3_min 1.0399
## strata(tgroup)tgroup=1:HR_min 1.0082
## strata(tgroup)tgroup=2:HR_min 1.0013
## strata(tgroup)tgroup=1:Lactate_max 1.0946
## strata(tgroup)tgroup=2:Lactate_max 0.9986
## exp(-coef)
## Age 0.9661
## BUN_max 0.9889
## Na_max 1.0413
## pH_min 1.5106
## Temp_max 1.1715
## Urine_min 1.0020
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=1 0.9781
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=1 3.1856
## ICUTypeMedical ICU:strata(tgroup)tgroup=1 0.8180
## ICUTypeSurgical ICU:strata(tgroup)tgroup=1 NA
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=2 0.9366
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=2 1.3595
## ICUTypeMedical ICU:strata(tgroup)tgroup=2 0.5791
## ICUTypeSurgical ICU:strata(tgroup)tgroup=2 NA
## strata(tgroup)tgroup=1:Albumin_min 1.2602
## strata(tgroup)tgroup=2:Albumin_min 0.9746
## strata(tgroup)tgroup=1:Bilirubin_max 0.9717
## strata(tgroup)tgroup=2:Bilirubin_max 1.0161
## strata(tgroup)tgroup=1:GCS_max 1.1368
## strata(tgroup)tgroup=2:GCS_max 1.0711
## strata(tgroup)tgroup=1:HCO3_min 1.0033
## strata(tgroup)tgroup=2:HCO3_min 0.9616
## strata(tgroup)tgroup=1:HR_min 0.9919
## strata(tgroup)tgroup=2:HR_min 0.9987
## strata(tgroup)tgroup=1:Lactate_max 0.9136
## strata(tgroup)tgroup=2:Lactate_max 1.0014
## lower .95 upper .95
## Age 1.0296 1.0407
## BUN_max 1.0085 1.0139
## Na_max 0.9456 0.9753
## pH_min 0.4492 0.9755
## Temp_max 0.7706 0.9455
## Urine_min 0.9962 0.9999
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=1 0.7335 1.4250
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=1 0.2102 0.4689
## ICUTypeMedical ICU:strata(tgroup)tgroup=1 0.9453 1.5809
## ICUTypeSurgical ICU:strata(tgroup)tgroup=1 NA NA
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=2 0.7359 1.5492
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=2 0.5189 1.0427
## ICUTypeMedical ICU:strata(tgroup)tgroup=2 1.2878 2.3158
## ICUTypeSurgical ICU:strata(tgroup)tgroup=2 NA NA
## strata(tgroup)tgroup=1:Albumin_min 0.6684 0.9421
## strata(tgroup)tgroup=2:Albumin_min 0.8547 1.2318
## strata(tgroup)tgroup=1:Bilirubin_max 1.0128 1.0458
## strata(tgroup)tgroup=2:Bilirubin_max 0.9512 1.0183
## strata(tgroup)tgroup=1:GCS_max 0.8530 0.9072
## strata(tgroup)tgroup=2:GCS_max 0.8994 0.9692
## strata(tgroup)tgroup=1:HCO3_min 0.9740 1.0199
## strata(tgroup)tgroup=2:HCO3_min 1.0150 1.0654
## strata(tgroup)tgroup=1:HR_min 1.0018 1.0146
## strata(tgroup)tgroup=2:HR_min 0.9938 1.0089
## strata(tgroup)tgroup=1:Lactate_max 1.0520 1.1390
## strata(tgroup)tgroup=2:Lactate_max 0.9337 1.0681
##
## Concordance= 0.749 (se = 0.009 )
## Likelihood ratio test= 577.1 on 24 df, p=<0.0000000000000002
## Wald test = 558.2 on 24 df, p=<0.0000000000000002
## Score (logrank) test = 607.6 on 24 df, p=<0.0000000000000002
# Calculate the split/no outlier model AIC
AIC.mv_reduced4.split.noutliers <- calc_aic(ICU.mv_reduced4.split.noutliers)
AIC.mv_reduced4.split.noutliers #10057 -- improvement
## [1] 10057.49
## Decision: use the 4th reduced model, split at time 3 months (90 days) on the split dataset with the outliers removed as the final dataset
ICU.final.cox <- coxph(Surv(Days, Status) ~
Age + ICUType:strata(tgroup) +
Albumin_min:strata(tgroup) +
Bilirubin_max:strata(tgroup) + BUN_max +
GCS_max:strata(tgroup) + HCO3_min:strata(tgroup) +
HR_min:strata(tgroup) + Lactate_max:strata(tgroup) +
Na_max + pH_min + Temp_max + Urine_min,
data = ICU.split_noutliers)
summary(ICU.final.cox)
## Call:
## coxph(formula = Surv(Days, Status) ~ Age + ICUType:strata(tgroup) +
## Albumin_min:strata(tgroup) + Bilirubin_max:strata(tgroup) +
## BUN_max + GCS_max:strata(tgroup) + HCO3_min:strata(tgroup) +
## HR_min:strata(tgroup) + Lactate_max:strata(tgroup) + Na_max +
## pH_min + Temp_max + Urine_min, data = ICU.split_noutliers)
##
## n= 3444, number of events= 721
##
## coef
## Age 0.0345124
## BUN_max 0.0111342
## Na_max -0.0404555
## pH_min -0.4124840
## Temp_max -0.1582918
## Urine_min -0.0019812
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=1 0.0221166
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=1 -1.1586329
## ICUTypeMedical ICU:strata(tgroup)tgroup=1 0.2008633
## ICUTypeSurgical ICU:strata(tgroup)tgroup=1 NA
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=2 0.0655282
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=2 -0.3071060
## ICUTypeMedical ICU:strata(tgroup)tgroup=2 0.5463547
## ICUTypeSurgical ICU:strata(tgroup)tgroup=2 NA
## strata(tgroup)tgroup=1:Albumin_min -0.2312474
## strata(tgroup)tgroup=2:Albumin_min 0.0257121
## strata(tgroup)tgroup=1:Bilirubin_max 0.0287543
## strata(tgroup)tgroup=2:Bilirubin_max -0.0159728
## strata(tgroup)tgroup=1:GCS_max -0.1281817
## strata(tgroup)tgroup=2:GCS_max -0.0686489
## strata(tgroup)tgroup=1:HCO3_min -0.0033246
## strata(tgroup)tgroup=2:HCO3_min 0.0391071
## strata(tgroup)tgroup=1:HR_min 0.0081504
## strata(tgroup)tgroup=2:HR_min 0.0013052
## strata(tgroup)tgroup=1:Lactate_max 0.0904054
## strata(tgroup)tgroup=2:Lactate_max -0.0013510
## exp(coef)
## Age 1.0351149
## BUN_max 1.0111965
## Na_max 0.9603519
## pH_min 0.6620038
## Temp_max 0.8536006
## Urine_min 0.9980208
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=1 1.0223630
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=1 0.3139150
## ICUTypeMedical ICU:strata(tgroup)tgroup=1 1.2224577
## ICUTypeSurgical ICU:strata(tgroup)tgroup=1 NA
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=2 1.0677228
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=2 0.7355726
## ICUTypeMedical ICU:strata(tgroup)tgroup=2 1.7269462
## ICUTypeSurgical ICU:strata(tgroup)tgroup=2 NA
## strata(tgroup)tgroup=1:Albumin_min 0.7935431
## strata(tgroup)tgroup=2:Albumin_min 1.0260455
## strata(tgroup)tgroup=1:Bilirubin_max 1.0291717
## strata(tgroup)tgroup=2:Bilirubin_max 0.9841541
## strata(tgroup)tgroup=1:GCS_max 0.8796935
## strata(tgroup)tgroup=2:GCS_max 0.9336545
## strata(tgroup)tgroup=1:HCO3_min 0.9966809
## strata(tgroup)tgroup=2:HCO3_min 1.0398819
## strata(tgroup)tgroup=1:HR_min 1.0081837
## strata(tgroup)tgroup=2:HR_min 1.0013060
## strata(tgroup)tgroup=1:Lactate_max 1.0946180
## strata(tgroup)tgroup=2:Lactate_max 0.9986499
## se(coef) z
## Age 0.0027499 12.550
## BUN_max 0.0013776 8.082
## Na_max 0.0078816 -5.133
## pH_min 0.1978059 -2.085
## Temp_max 0.0521644 -3.034
## Urine_min 0.0009464 -2.093
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=1 0.1694156 0.131
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=1 0.2047092 -5.660
## ICUTypeMedical ICU:strata(tgroup)tgroup=1 0.1311915 1.531
## ICUTypeSurgical ICU:strata(tgroup)tgroup=1 0.0000000 NA
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=2 0.1898951 0.345
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=2 0.1780033 -1.725
## ICUTypeMedical ICU:strata(tgroup)tgroup=2 0.1496993 3.650
## ICUTypeSurgical ICU:strata(tgroup)tgroup=2 0.0000000 NA
## strata(tgroup)tgroup=1:Albumin_min 0.0875372 -2.642
## strata(tgroup)tgroup=2:Albumin_min 0.0932299 0.276
## strata(tgroup)tgroup=1:Bilirubin_max 0.0081724 3.518
## strata(tgroup)tgroup=2:Bilirubin_max 0.0173879 -0.919
## strata(tgroup)tgroup=1:GCS_max 0.0157330 -8.147
## strata(tgroup)tgroup=2:GCS_max 0.0190784 -3.598
## strata(tgroup)tgroup=1:HCO3_min 0.0117341 -0.283
## strata(tgroup)tgroup=2:HCO3_min 0.0123778 3.159
## strata(tgroup)tgroup=1:HR_min 0.0032554 2.504
## strata(tgroup)tgroup=2:HR_min 0.0038581 0.338
## strata(tgroup)tgroup=1:Lactate_max 0.0202818 4.457
## strata(tgroup)tgroup=2:Lactate_max 0.0342960 -0.039
## Pr(>|z|)
## Age < 0.0000000000000002
## BUN_max 0.000000000000000636
## Na_max 0.000000285293278950
## pH_min 0.037042
## Temp_max 0.002410
## Urine_min 0.036316
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=1 0.896134
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=1 0.000000015146402643
## ICUTypeMedical ICU:strata(tgroup)tgroup=1 0.125752
## ICUTypeSurgical ICU:strata(tgroup)tgroup=1 NA
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=2 0.730037
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=2 0.084477
## ICUTypeMedical ICU:strata(tgroup)tgroup=2 0.000263
## ICUTypeSurgical ICU:strata(tgroup)tgroup=2 NA
## strata(tgroup)tgroup=1:Albumin_min 0.008249
## strata(tgroup)tgroup=2:Albumin_min 0.782708
## strata(tgroup)tgroup=1:Bilirubin_max 0.000434
## strata(tgroup)tgroup=2:Bilirubin_max 0.358295
## strata(tgroup)tgroup=1:GCS_max 0.000000000000000372
## strata(tgroup)tgroup=2:GCS_max 0.000320
## strata(tgroup)tgroup=1:HCO3_min 0.776925
## strata(tgroup)tgroup=2:HCO3_min 0.001581
## strata(tgroup)tgroup=1:HR_min 0.012291
## strata(tgroup)tgroup=2:HR_min 0.735142
## strata(tgroup)tgroup=1:Lactate_max 0.000008293318325089
## strata(tgroup)tgroup=2:Lactate_max 0.968577
##
## Age ***
## BUN_max ***
## Na_max ***
## pH_min *
## Temp_max **
## Urine_min *
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=1
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=1 ***
## ICUTypeMedical ICU:strata(tgroup)tgroup=1
## ICUTypeSurgical ICU:strata(tgroup)tgroup=1
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=2
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=2 .
## ICUTypeMedical ICU:strata(tgroup)tgroup=2 ***
## ICUTypeSurgical ICU:strata(tgroup)tgroup=2
## strata(tgroup)tgroup=1:Albumin_min **
## strata(tgroup)tgroup=2:Albumin_min
## strata(tgroup)tgroup=1:Bilirubin_max ***
## strata(tgroup)tgroup=2:Bilirubin_max
## strata(tgroup)tgroup=1:GCS_max ***
## strata(tgroup)tgroup=2:GCS_max ***
## strata(tgroup)tgroup=1:HCO3_min
## strata(tgroup)tgroup=2:HCO3_min **
## strata(tgroup)tgroup=1:HR_min *
## strata(tgroup)tgroup=2:HR_min
## strata(tgroup)tgroup=1:Lactate_max ***
## strata(tgroup)tgroup=2:Lactate_max
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef)
## Age 1.0351
## BUN_max 1.0112
## Na_max 0.9604
## pH_min 0.6620
## Temp_max 0.8536
## Urine_min 0.9980
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=1 1.0224
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=1 0.3139
## ICUTypeMedical ICU:strata(tgroup)tgroup=1 1.2225
## ICUTypeSurgical ICU:strata(tgroup)tgroup=1 NA
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=2 1.0677
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=2 0.7356
## ICUTypeMedical ICU:strata(tgroup)tgroup=2 1.7269
## ICUTypeSurgical ICU:strata(tgroup)tgroup=2 NA
## strata(tgroup)tgroup=1:Albumin_min 0.7935
## strata(tgroup)tgroup=2:Albumin_min 1.0260
## strata(tgroup)tgroup=1:Bilirubin_max 1.0292
## strata(tgroup)tgroup=2:Bilirubin_max 0.9842
## strata(tgroup)tgroup=1:GCS_max 0.8797
## strata(tgroup)tgroup=2:GCS_max 0.9337
## strata(tgroup)tgroup=1:HCO3_min 0.9967
## strata(tgroup)tgroup=2:HCO3_min 1.0399
## strata(tgroup)tgroup=1:HR_min 1.0082
## strata(tgroup)tgroup=2:HR_min 1.0013
## strata(tgroup)tgroup=1:Lactate_max 1.0946
## strata(tgroup)tgroup=2:Lactate_max 0.9986
## exp(-coef)
## Age 0.9661
## BUN_max 0.9889
## Na_max 1.0413
## pH_min 1.5106
## Temp_max 1.1715
## Urine_min 1.0020
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=1 0.9781
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=1 3.1856
## ICUTypeMedical ICU:strata(tgroup)tgroup=1 0.8180
## ICUTypeSurgical ICU:strata(tgroup)tgroup=1 NA
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=2 0.9366
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=2 1.3595
## ICUTypeMedical ICU:strata(tgroup)tgroup=2 0.5791
## ICUTypeSurgical ICU:strata(tgroup)tgroup=2 NA
## strata(tgroup)tgroup=1:Albumin_min 1.2602
## strata(tgroup)tgroup=2:Albumin_min 0.9746
## strata(tgroup)tgroup=1:Bilirubin_max 0.9717
## strata(tgroup)tgroup=2:Bilirubin_max 1.0161
## strata(tgroup)tgroup=1:GCS_max 1.1368
## strata(tgroup)tgroup=2:GCS_max 1.0711
## strata(tgroup)tgroup=1:HCO3_min 1.0033
## strata(tgroup)tgroup=2:HCO3_min 0.9616
## strata(tgroup)tgroup=1:HR_min 0.9919
## strata(tgroup)tgroup=2:HR_min 0.9987
## strata(tgroup)tgroup=1:Lactate_max 0.9136
## strata(tgroup)tgroup=2:Lactate_max 1.0014
## lower .95 upper .95
## Age 1.0296 1.0407
## BUN_max 1.0085 1.0139
## Na_max 0.9456 0.9753
## pH_min 0.4492 0.9755
## Temp_max 0.7706 0.9455
## Urine_min 0.9962 0.9999
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=1 0.7335 1.4250
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=1 0.2102 0.4689
## ICUTypeMedical ICU:strata(tgroup)tgroup=1 0.9453 1.5809
## ICUTypeSurgical ICU:strata(tgroup)tgroup=1 NA NA
## ICUTypeCoronary Care Unit:strata(tgroup)tgroup=2 0.7359 1.5492
## ICUTypeCardiac Surgery Recovery Unit:strata(tgroup)tgroup=2 0.5189 1.0427
## ICUTypeMedical ICU:strata(tgroup)tgroup=2 1.2878 2.3158
## ICUTypeSurgical ICU:strata(tgroup)tgroup=2 NA NA
## strata(tgroup)tgroup=1:Albumin_min 0.6684 0.9421
## strata(tgroup)tgroup=2:Albumin_min 0.8547 1.2318
## strata(tgroup)tgroup=1:Bilirubin_max 1.0128 1.0458
## strata(tgroup)tgroup=2:Bilirubin_max 0.9512 1.0183
## strata(tgroup)tgroup=1:GCS_max 0.8530 0.9072
## strata(tgroup)tgroup=2:GCS_max 0.8994 0.9692
## strata(tgroup)tgroup=1:HCO3_min 0.9740 1.0199
## strata(tgroup)tgroup=2:HCO3_min 1.0150 1.0654
## strata(tgroup)tgroup=1:HR_min 1.0018 1.0146
## strata(tgroup)tgroup=2:HR_min 0.9938 1.0089
## strata(tgroup)tgroup=1:Lactate_max 1.0520 1.1390
## strata(tgroup)tgroup=2:Lactate_max 0.9337 1.0681
##
## Concordance= 0.749 (se = 0.009 )
## Likelihood ratio test= 577.1 on 24 df, p=<0.0000000000000002
## Wald test = 558.2 on 24 df, p=<0.0000000000000002
## Score (logrank) test = 607.6 on 24 df, p=<0.0000000000000002
For your final model, present a set of diagnostic statistics and/or charts and comment on them.
Write a very brief paragraph summarising the most important findings of your final model. Include the most important values from the statistical output, and a simple clinical interpretation.
Create your response to this task here, as a mixture of embedded (knitr) R code and any resulting outputs, and explanatory or commentary text.
Reminder: don’t forget to save this file, to knit it to check that everything works, and then submit via the drop box in OpenLearning.
When you have finished, and are satisfied with your assignment solutions, and this file knits without errors and the output looks the way you want, then you should submit via the drop box in OpenLearning.
If you encounter problems with any part of the process described above, please contact the course convenor via OpenLearning as soon as possible so that the issues can be resolved in good time, and well before the assignment is due.
Each task attracts the indicated number of marks (out of a total of 30 marks for the assignment). The instructions are deliberately open-ended and less prescriptive than the individual assignments to allow you some latitude in what you do and how you go about the task. However, to complete the tasks and gain full marks, you only need to replicate or repeat the steps covered in the course - if you do most or all of the things described in the revalant chapters of the HDAT9600 course, full marks will be awarded.
Note also that with respect to the model fitting, there are no right or wrong answers when it comes to variable selection and other aspects of model specification. Deep understanding of the underlying medical concepts which govern patient treatment and outcomes in ICUs is not required or assumed, although you should try to gain some understanding of each variable using the links provided. You will not be marked down if your medical justifications are not exactly correct or complete, but do you best, and don’t hesitate to seek help from the course convenor.